diff --git a/check_reversetunnel b/check_reversetunnel new file mode 100755 index 0000000..4533987 --- /dev/null +++ b/check_reversetunnel @@ -0,0 +1,18 @@ +#!/bin/sh +# +AUTOSSH_PIDs=$(pidof autossh) +if [ -z $AUTOSSH_PIDs ]; then + # no autossh process running + echo "No autossh process is running!" + exit 2 +else + # there is an autossh process + ps x -q $AUTOSSH_PIDs | grep "\-R 10022:localhost:22.*mount-mockery.de$" 2>&1 > /dev/null + if [ $? -eq 0 ]; then + echo "The required autossh process is running" + exit 0 + else + echo "There are autossh processes, but none of them fit to the required connection details" + exit 2 + fi +fi