From 67b32ce1661547c8569610b04ffaab649ff5fd2d Mon Sep 17 00:00:00 2001 From: smallsolar Date: Wed, 3 Sep 2025 07:05:15 +0000 Subject: [PATCH] Add alpine_chroot/stunnel.sh --- alpine_chroot/stunnel.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 alpine_chroot/stunnel.sh 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