Skip to content

Instantly share code, notes, and snippets.

@ryanbarrett
Created July 2, 2015 02:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanbarrett/7527a89a844e4be1f1aa to your computer and use it in GitHub Desktop.
Save ryanbarrett/7527a89a844e4be1f1aa to your computer and use it in GitHub Desktop.
Crontab; start a program if it is not running
#!/bin/sh
if ps -ef | grep -v grep | grep program.sh ; then
exit 0
else
~/scripts/program.sh >> /dev/null &
echo "Restarting program.sh, it was not running." | wall
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment