Hello, I have that sh script:
and it works well. But no matter what I tried, it won't just work via cron.
I tried all these variations, still not loading via crontab:
Cron Logs:
Code:
#!/bin/sh
DATE=`date +%Y-%m-%d:%H:%M:%S`
NAME="game"
if ps ax | grep -v grep | grep $NAME > /dev/null
then
echo "$NAME service running, everything is fine"
else
echo "$DATE: Restarting $NAME" >> /root/log
cd /usr/home/game/db && ./game
fi
and it works well. But no matter what I tried, it won't just work via cron.
I tried all these variations, still not loading via crontab:
Code:
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/home:/root
* * * * * /bin/sh /root/restart.sh
* * * * * /root/restart.sh
* * * * * sh /root/restart.sh
Cron Logs:
Code:
Aug 22 09:12:00 FE8 /usr/sbin/cron[94432]: (root) CMD (/root/restart.sh^M)
Aug 22 09:12:00 FE8 /usr/sbin/cron[94433]: (root) CMD (/bin/sh /root/restart.sh^M)