From e6c79d209fc91f077eda0b55c89a45a0b651ff77 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 14 Feb 2020 16:41:07 +0000 Subject: [PATCH] get rid of autossh and work around "bash -e" terminating while loop --- sysconfig/etc_rc.local | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sysconfig/etc_rc.local b/sysconfig/etc_rc.local index 42df5f6..ae3e018 100755 --- a/sysconfig/etc_rc.local +++ b/sysconfig/etc_rc.local @@ -19,28 +19,28 @@ fi sudo -u automation /home/automation/chch-power/run.sh -{ +( + set +e # disable bash errexit sleep 60 - while /bin/true; - do + while true; do # cat ~/.ssh/authorized_key # restrict,command="",port-forwarding ssh-rsa AAAA... - autossh ssh-port-forwarding@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' + 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 $! +) & +disown -{ +( + set +e # disable bash errexit sleep 60 - while /bin/true; - do + while true; do # cat ~/.ssh/authorized_key # restrict,command="",port-forwarding ssh-rsa AAAA... - autossh ssh-port-forwarding@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' + 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 $! +) & +disown exit 0