#!/bin/sh # raroif.sh # # 2017-07-28 Daniel 'hackbyte' Mitzlaff # # rinse and repeat, only if necessary # # insert in $COMMAND the exact commandline of the cmd # you need to repeat or keep going.. # # $COMMAND is the command used to create the reverse ssh tunnel COMMAND="/bin/true is my command i need to start and keep going" ##### done, no need to edit anything below. ;) # Here the magic, no need to touch, it will do what you need pgrep -f -x "$COMMAND" > /dev/null 2>&1 || $COMMAND >/dev/null 2>&1 &