Created
July 6, 2012 07:39
-
-
Save tagroup/3058718 to your computer and use it in GitHub Desktop.
Script to open a reverse ssh tunnel if a specific file exists on a server with 'yes' in it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
WGET="/usr/bin/wget" | |
$WGET -q --tries=10 --timeout=5 http://youralwaysonserver/openpi.php -O /tmp/openpi &> /dev/null | |
if grep -Fxq "yes" /tmp/openpi | |
then | |
ssh -gNnT -R *:55555:raspberrypi.local:80 piremoteuser@youralwaysonserver & | |
PID=$! | |
echo "Opened" | |
sleep 360s; | |
kill $PID | |
echo "Closed" | |
else | |
echo "no" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment