chch-power/sysconfig/etc_rc.local

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
(
set +e # disable bash errexit
sleep 60
while true; do
# cat ~/.ssh/authorized_key
# restrict,command="",port-forwarding ssh-rsa AAAA...
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'
sleep 30
done
) &
disown
(
set +e # disable bash errexit
sleep 60
while true; do
# cat ~/.ssh/authorized_key
# restrict,command="",port-forwarding ssh-rsa AAAA...
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'
sleep 30
done
) &
disown
exit 0