boxmein

automatic ssh tunnel thing

Jun 11th, 2015
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #!/bin/bash
  2. createTunnel() {
  3. /usr/bin/ssh -N -R 2222:localhost:22 [email protected]
  4. if [[ $? -eq 0 ]]; then
  5. echo successful tunnel to mniip.com!
  6. else
  7. echo exit code $? - error tunnelling to mniip.com
  8. fi
  9. }
  10. /bin/pidof ssh
  11. if [[ $? -ne 0 ]]; then
  12. echo tunnel was down, reopening
  13. createTunnel
  14. fi
Advertisement
Add Comment
Please, Sign In to add comment