Check if not running then start
// This is to check if a process is running. Used with my bot
#!/bin/sh # Check if bot is runing then exit otherwise restart # put in crontab # 0,10,20,30,40,50 * * * * /path/to/check.sh MYPATH=/path/to PID=0 if test -r $MYPATH/bot.pid; then PID=$(cat $MYPATH/bot.pid) fi if [ 0 -ne $PID ]; then running=`ps --pid $PID | grep $PID |wc -l` if [ $running -eq 1 ]; then exit 1 fi fi cd $MYPATH ./check.sh & >/dev/null