This is a stupid simple bash example that will allow you to do that. I'm using it to restart a python notebook.
#!/bin/bash #This silly script was written by @bentaylordata to handle auto restarting of processes in cron #Check if string is running string_of_interest="ipython" OUTPUT="$(ps -ef | grep $string_of_interest | wc -l)" if [ "$OUTPUT" -gt "1" ] then echo "started" else echo "need to start" ipython notebook --profile=nbserver --no-mathjax & #This backgrounds the notebook server fi