Crontab not executing as it should

It happens to the best of us 😉
I have this script, and it should execute every 5 minutes, so I enter a line into crontab (# crontab -e), but nothing happens.
Here are some possible reasons this happens (or in my case, doesn’t) :

1. At the end of a crontab entry there MUST be a empty line, if there isn’t one, cron will report no error, but it will not work either.
2. Command in script is not in a cron user PATH.
That can be fixed by putting a PATH into the script itself :
#!/bin/bash
PATH=/bin:/sbin/:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin
3. Script is not executed, or at lest not executed by a cron user.
For starters set script to 777, and see what happens. Check with :
# pgrep cron
or
# ps -axf|grep cron
or
# service crond status
Check if cron service is running…..

This entry was posted in Linux and tagged . Bookmark the permalink.

Comments are closed.