Log in with an SSH private key on Linux
chmod 600 deployment_key.txt
ssh -i deployment_key.txt [email protected]
References
https://support.rackspace.com/how-to/logging-in-with-an-ssh-private-key-on-linuxmac/
Daily Notes of a Programmer
chmod 600 deployment_key.txt
ssh -i deployment_key.txt [email protected]
References
https://support.rackspace.com/how-to/logging-in-with-an-ssh-private-key-on-linuxmac/
extute ip route show
and compare route table before and after connecting to the vpn server to get all required addresses
start.sh
#!/bin/sh [ "$UID" -eq 0 ] || exec sudo "$0" "$@" vpnclient start sleep 2s vpncmd localhost /client /CMD AccountConnect [ConnectionName] dhclient [VPN_Adapter] ip route add [VPN_Server_IP]/32 via [Gateway_Address] dev [Network_Device_Name] ip route del default via [Gateway_Address] dev [Network_Device_Name]
#!/bin/sh [ "$UID" -eq 0 ] || exec sudo "$0" "$@" vpnclient start sleep 2s vpncmd localhost /client /CMD AccountConnect GE dhclient vpn_vpn ip route add 145.245.93.56/32 via 192.168.1.1 dev wlp3s0 ip route del default via 192.168.1.1 dev wlp3s0
stop.sh
#!/bin/sh [ "$UID" -eq 0 ] || exec sudo "$0" "$@" vpncmd localhost /client /CMD AccountDisconnect GE vpnclient stop ip route del default via 192.168.30.1 dev vpn_vpn ip route del 145.245.93.56 via 192.168.1.1 dev wlp3s0 ip route del 192.168.30.0/24 dev vpn_vpn proto kernel scope link src ip route add default via 192.168.1.1 dev wlp3s0 proto dhcp metric 600 echo 'nameserver 8.8.8.8' > /etc/resolv.conf echo 'nameserver 8.8.4.4' >> /etc/resolv.conf
References
https://pupli.net/2016/09/19/how-to-setup-softether-in-ubuntu/
[ "$UID" -eq 0 ] || exec sudo "$0" "$@"
References
https://askubuntu.com/questions/746350/request-root-privilege-from-within-a-script/748362
https://unix.stackexchange.com/questions/28791/prompt-for-sudo-password-and-programmatically-elevate-privilege-in-bash-script
https://stackoverflow.com/questions/3976362/bash-scripts-requiring-sudo-password
You can redirect the output of a command to a file:
cat file > copy_file
or append to it
cat file >> copy_file
If you want to write directly the command is echo ‘text’
echo 'Hello World' > file
Or
# possibility 1: echo "line 1" >> greetings.txt echo "line 2" >> greetings.txt # possibility 2: echo "line 1 line 2" >> greetings.txt # possibility 3: cat <<EOT >> greetings.txt line 1 line 2 EOT
References
https://stackoverflow.com/questions/11162406/open-and-write-data-to-text-file-using-bash-shell-scripting
https://unix.stackexchange.com/questions/77277/how-to-append-multiple-lines-to-a-file
You need to have a @require
in the user script header to load jQuery. Something like:
// @require http://code.jquery.com/jquery-3.3.1.min.js
References
https://stackoverflow.com/questions/24753908/trying-to-load-jquery-into-tampermonkey-script
Though timesyncd is fine for most purposes, some applications that are very sensitive to even the slightest perturbations in time may be better served by ntpd, as it uses more sophisticated techniques to constantly and gradually keep the system time on track.
sudo timedatectl set-ntp no
timedatectl
sudo apt-get install ntp
sudo ntpq -p
References
https://www.digitalocean.com/community/tutorials/how-to-set-up-time-synchronization-on-ubuntu-16-04
nohup my_command > my.log 2>&1 & echo $! > save_pid.txt
kill -9 `cat save_pid.txt` rm save_pid.txt
References
https://stackoverflow.com/questions/17385794/how-to-get-the-process-id-to-kill-a-nohup-process
/etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu bionic universe multiverse deb-src http://archive.ubuntu.com/ubuntu bionic universe multiverse deb http://us.archive.ubuntu.com/ubuntu/ bionic universe deb-src http://us.archive.ubuntu.com/ubuntu/ bionic universe deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe deb http://us.archive.ubuntu.com/ubuntu/ bionic multiverse deb-src http://us.archive.ubuntu.com/ubuntu/ bionic multiverse deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse deb http://security.ubuntu.com/ubuntu bionic-security universe deb-src http://security.ubuntu.com/ubuntu bionic-security universe deb http://security.ubuntu.com/ubuntu bionic-security multiverse deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse
References
https://help.ubuntu.com/lts/serverguide/configuration.html.en
Spring Boot 1.x
jar { baseName = 'interface' version = '0.0.1-SNAPSHOT' manifest { attributes 'Main-Class': 'net.pupli.sobhan.SobhanApplication' } }
Spring Boot 2.x
springBoot { mainClassName = 'org.baeldung.DemoApplication' }
or
bootJar { mainClassName = 'org.baeldung.DemoApplication' }
bootJar { manifest { attributes 'Start-Class': 'org.baeldung.DemoApplication' } }
References
In Boot 2.x, the bootJar and bootWar tasks are responsible for packaging the application.
bootJar { baseName = 'gs-spring-boot' version = '0.1.0' }
References
https://spring.io/guides/gs/spring-boot/
https://www.baeldung.com/spring-boot-gradle-plugin
https://www.baeldung.com/spring-boot-main-class