Crontab does not kick at the given time

I have crontab set to be triggered daily @ 8 am and 8:20 am server time.

00 08 * * * /web/scripts/check.sh
20 08 * * * /web/scripts/check.sh
uname -a
Linux mymac 3.10.0-327.36.3.el7.x86_64 #1 SMP Thu Oct 20 04:56:07 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux
ls -ltr /web/scripts/check.sh
-rwxrwxr-x 1 user1 user1 10180 Nov 10 13:41 /web/scripts/check.sh

The check.sh generates a file with the date timestamp using >> (redirection). Running the check.sh manually works fine and i see the updated timestamp.

Can you please let me know why check.sh did not get triggered all these days when i set it to trigger everyday @ 8 am and 8:20 am.

The usual problem with cron, common enough it's in the FAQ, is that it runs with a very minimal PATH and because of that occasionally misses common commands. Are you sure all the commands you want are in cron's PATH? Have you tried exporting a complete PATH yourself in script?

You can see in the system logs if and when the scripts were started. Redirect its stderr to a file so you can analyse its behaviour (failure) after it ran.

Hello mohtashims,

Could you please try following points and let us know.
i- Try to run your script manually once to make sure it is running correctly.
ii- If first option works fine then go to cron logs /var/log/cron and see there what's happening.

Thanks,
R. Singh

This is most likely caused by what Corona688 said in post#2.

However, I would ask how you put these entries into cron? Did you edit the crontab yourself or did you use the crontab command?

If you edited it yourself then cron may not know that the new entries are there so try restarting the cron daemon.

Can you give me the command to redirect the STD err?

exec 2>>/tmp/mycronlogfile
1 Like
more /var/log/cron

Nov 28 08:00:04 mymac CROND[50491]: (user1) CMD (/web/scripts/check.sh)

I see the entry in the cron system logs as above.

i- Try to run your script manually once to make sure it is running correctly. -> Done. Works fine manually.

Can yu now suggest something ?? what should i do now ?

Please read post #2.

redirecting the err helped resolve the issue (looks like for now)

It showed up permissions error which i fixed in the script.

Resolved .... Thank you all.:slight_smile: