hackbyte

raroif.sh # rinse and repeat, only if necessary

Jul 28th, 2017
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.52 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # raroif.sh
  4. #
  5. # 2017-07-28 Daniel 'hackbyte' Mitzlaff
  6. #
  7. # rinse and repeat, only if necessary
  8. #
  9. # insert in $COMMAND the exact commandline of the cmd
  10. # you need to repeat or keep going..
  11. #
  12.  
  13. # $COMMAND is the command used to create the reverse ssh tunnel
  14. COMMAND="/bin/true is my command i need to start and keep going"
  15.  
  16. ##### done, no need to edit anything below. ;)
  17.  
  18. # Here the magic, no need to touch, it will do what you need
  19. pgrep -f -x "$COMMAND" > /dev/null 2>&1 || $COMMAND >/dev/null 2>&1 &
Advertisement
Add Comment
Please, Sign In to add comment