Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ## To use: `ssh -p 33333 <name>@localhost` from server
- server="tesla@tesla.myserver.com"
- port=$(cut -c 13-17 < /var/etc/vin)
- localHost="localhost"
- if [ "$server" == "tesla@yourserver.com" ]; then
- echo "Script not yet setup, quitting"
- exit 1
- fi
- while : ; do
- RET=`ps ax | grep "$localHost:22" | grep -v "grep"`
- if [ "$RET" = "" ];then
- ssh -p 22 -N -T -R $port:127.0.0.1:22 -o ServerAliveInterval=3 -o StrictHostKeyChecking=no -o ExitOnForwardFailure=yes $server
- fi
- sleep 60
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement