Skip to content

Instantly share code, notes, and snippets.

@prelongs
Created March 21, 2014 03:32
Show Gist options
  • Save prelongs/9678995 to your computer and use it in GitHub Desktop.
Save prelongs/9678995 to your computer and use it in GitHub Desktop.
#!/bin/bash
while [ " == " ]
do
ssh_d_process_num=`ps aux |grep -E 'ssh ' |grep localhost |grep -v grep | wc -l`
if [ "$ssh_d_process_num" == "0" ]; then
echo "Trying to reconnect..."
ssh -gNfR *:10000:localhost:22 [email protected] -p2222 &
fi
sleep 60
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment