2017-02-20 00:03:36 +01:00
|
|
|
#!/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
|
|
|
|
|
2020-02-14 17:41:07 +01:00
|
|
|
(
|
|
|
|
set +e # disable bash errexit
|
2017-02-20 17:36:26 +01:00
|
|
|
sleep 60
|
2020-02-14 17:41:07 +01:00
|
|
|
while true; do
|
2017-03-02 22:12:12 +01:00
|
|
|
# cat ~/.ssh/authorized_key
|
2018-10-30 18:52:47 +01:00
|
|
|
# restrict,command="",port-forwarding ssh-rsa AAAA...
|
2020-02-14 17:41:07 +01:00
|
|
|
ssh ssh-port-forwarding@vbox.chch.it -TNnqakx -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' -L '127.0.0.1:2525:127.0.0.1:25'
|
2018-09-30 04:24:36 +02:00
|
|
|
sleep 30
|
2017-02-20 00:03:36 +01:00
|
|
|
done
|
2020-02-14 17:41:07 +01:00
|
|
|
) &
|
|
|
|
disown
|
2017-02-20 00:03:36 +01:00
|
|
|
|
2020-02-14 17:41:07 +01:00
|
|
|
(
|
|
|
|
set +e # disable bash errexit
|
2017-02-20 17:36:26 +01:00
|
|
|
sleep 60
|
2020-02-14 17:41:07 +01:00
|
|
|
while true; do
|
2017-03-02 22:12:12 +01:00
|
|
|
# cat ~/.ssh/authorized_key
|
2018-10-30 18:52:47 +01:00
|
|
|
# restrict,command="",port-forwarding ssh-rsa AAAA...
|
2020-02-14 17:41:07 +01:00
|
|
|
ssh ssh-port-forwarding@vcup.chch.it -TNnqakx -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'
|
2018-09-30 04:24:36 +02:00
|
|
|
sleep 30
|
2017-02-20 00:03:36 +01:00
|
|
|
done
|
2020-02-14 17:41:07 +01:00
|
|
|
) &
|
|
|
|
disown
|
2017-02-20 00:03:36 +01:00
|
|
|
|
|
|
|
exit 0
|