47 lines
1.1 KiB
Bash
Executable File
47 lines
1.1 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_FIRST_POLL=30 AUTOSSH_POLL=15 /usr/bin/autossh -N -M 20023 -4 -R '127.0.0.1:2322:127.0.0.1:22' automation@vbox.chch.it
|
|
sleep 10
|
|
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_FIRST_POLL=30 AUTOSSH_POLL=15 /usr/bin/autossh -N -M 20025 -4 -R '127.0.0.1:2322:127.0.0.1:22' cloudbot@vcup.chch.it
|
|
sleep 10
|
|
done
|
|
} &
|
|
disown $!
|
|
|
|
exit 0
|