Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. ## To use: `ssh -p 33333 <name>@localhost` from server
  4.  
  5. server="tesla@tesla.myserver.com"
  6. port=$(cut -c 13-17 < /var/etc/vin)
  7. localHost="localhost"
  8.  
  9. if [ "$server" == "tesla@yourserver.com" ]; then
  10. echo "Script not yet setup, quitting"
  11. exit 1
  12. fi
  13.  
  14. while : ; do
  15. RET=`ps ax | grep "$localHost:22" | grep -v "grep"`
  16. if [ "$RET" = "" ];then
  17. ssh -p 22 -N -T -R $port:127.0.0.1:22 -o ServerAliveInterval=3 -o StrictHostKeyChecking=no -o ExitOnForwardFailure=yes $server
  18. fi
  19. sleep 60
  20. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement