diff --git a/alpine_chroot/stunnel.sh b/alpine_chroot/stunnel.sh new file mode 100644 index 0000000..edce5b2 --- /dev/null +++ b/alpine_chroot/stunnel.sh @@ -0,0 +1,35 @@ +sh /root/uptime_monitor.sh & + +while [ 1 ] +do + + if nc -zv -w 2 88.202.151.14 5222 &> /dev/null + then + echo "$(date): success" + echo "$(date): now check whether PID is present (as might be old connection)" + + else + echo "$(date): error - xmpp is down, start tunnel 5222" + /usr/bin/ssh -R '*:5222:127.0.0.1:5222' -p 22 -N user@88.202.151.14 & + sleep 2 + + fi + + + if nc -zv -w 2 88.202.151.14 5269 &> /dev/null + then + echo "$(date): success" + echo "$(date): now check whether PID is present (as might be old connection)" + + else + echo "$(date): error - xmpp is down, start tunnel 5269" + /usr/bin/ssh -R '*:5269:127.0.0.1:5269' -p 22 -N user@88.202.151.14 & + sleep 2 + + fi + + sleep 60 + +done + +echo "$(date): Done" \ No newline at end of file