47 lines
1.2 KiB
Bash
Executable File
47 lines
1.2 KiB
Bash
Executable File
#!/bin/bash -e
|
|
#
|
|
# rc.local
|
|
#
|
|
# This script is executed at the end of each multiuser runlevel.
|
|
# Make sure that the script will "exit 0" on success or any other
|
|
# value on error.
|
|
#
|
|
# In order to enable or disable this script just change the execution
|
|
# bits.
|
|
#
|
|
# By default this script does nothing.
|
|
|
|
# Print the IP address
|
|
_IP=$(hostname -I) || true
|
|
if [ "$_IP" ]; then
|
|
printf "My IP address is %s\n" "$_IP"
|
|
fi
|
|
|
|
sudo -u automation /home/automation/chch-power/run.sh
|
|
|
|
{
|
|
sleep 60
|
|
while /bin/true;
|
|
do
|
|
# cat ~/.ssh/authorized_key
|
|
# permitopen="127.0.0.1:20023",command="",no-pty,no-agent-forwarding,no-X11-forwarding ssh-rsa AAAA...
|
|
autossh automation@vbox.chch.it -M 0 -o "TCPKeepAlive yes" -o "ServerAliveInterval 5" -o "ServerAliveCountMax 3" -o "ExitOnForwardFailure yes" -N -4 -R '127.0.0.1:2322:127.0.0.1:22'
|
|
sleep 30
|
|
done
|
|
} &
|
|
disown $!
|
|
|
|
{
|
|
sleep 60
|
|
while /bin/true;
|
|
do
|
|
# cat ~/.ssh/authorized_key
|
|
# permitopen="127.0.0.1:20025",command="",no-pty,no-agent-forwarding,no-X11-forwarding ssh-rsa AAAA...
|
|
autossh cloudbot@vcup.chch.it -M 0 -o "TCPKeepAlive yes" -o "ServerAliveInterval 5" -o "ServerAliveCountMax 3" -o "ExitOnForwardFailure yes" -N -4 -R '127.0.0.1:2322:127.0.0.1:22'
|
|
sleep 30
|
|
done
|
|
} &
|
|
disown $!
|
|
|
|
exit 0
|