Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- SSHCMD='ssh -fND 8080 [email protected] -p5000'
- CURPRO=$(ps -eo pid,command | sed 's/^ //' | grep -v 'grep' | grep "$SSHCMD" | cut -d' ' -f1 | tr '\n' ' ')
- *()
- {
- echo 'wrong or missing argument. Exiting.'
- }
- start()
- {
- if [[ $CURPRO -eq 0 ]]
- then
- echo 'starting ssh socks proxy'
- $CURPRO
- else
- CONTINUE=no
- echo 'ssh socks proxy seems to be started already. Restart? (y/N)'
- read CONTINUE
- if [[ $CONTINUE == y ]]
- then
- restart
- else
- exit
- fi
- fi
- }
- restart()
- {
- echo restart
- }
- stop()
- {
- echo stop
- }
- case $1 in
- start|restart|stop) "$1" ;;
- *) echo 'wrong or missing argument. Exiting.'
- esac
Advertisement
Add Comment
Please, Sign In to add comment