crontab taks not running

Viewed 6

signed in as root user, crontab -e has a single line entry:

*/1 * * * * /opt/launch-crashed-services.sh > /dev/null 2>

the /opt directory has the following permissions defined for that script

-rwxr-xr-x  1 root             root  179 Sep 20 06:47 launch-crashed-services.sh

which should thus run every minute a check that nginx is running and restart if not, dumping the output to a log file.

service nginx status | grep 'active (running)' > /dev/null 2>&1

if [ $? != 0 ]
then
        sudo service nginx restart > /var/log/nginx/relaunch.log  # /dev/null
fi

The status of nginx is frequently inactive for long periods & said log file is empty.
Thus this script is either not being fired or somehow fires, but incorrectly.

Where is this set-up mistaken?

0 Answers
Related