Why doesn't this Cronjob instruction run?

martin MHC

Well-Known Member
Sep 14, 2016
345
75
78
UK
cPanel Access Level
Root Administrator
I have a long standing cronjob running on a cPanel account. Recently I have added a second cronjob instruction to make two in total.

They are here:


ONE:

*/522-23,0-1*** /usr/local/bin/php /home/account/crons/cron_mailer.php >/dev/null 2>&1

TWO:

150,8,16*** /usr/local/bin/php /home/account/crons/error_cleaner.php >/dev/null 2>&1

The first, has been long standing and I believe this to be working correctly.
The second, is new and the instruction "/usr ....error_cleaner.php .... 2>&1" works perfectly when run from the Terminal command line.

The Cron timings ate also correct as per cron-tab guru, to run on the 0,8,16th hour each day. However, I am not seeing any indictication on the system that this crontab ever actually runs (no purposeful error reports that the script ran).


How can I diagnose this ?
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
16,651
2,636
363
cPanel Access Level
Root Administrator
Hey there! Inside /var/log/cron, you should see entries similar to the following when you edit the user's cron jobs:

Code:
Jan 16 07:36:08 host crontab[196369]: (hattmonk) LIST (username)
Jan 16 07:36:10 host crontab[196375]: (hattmonk) LIST (username)
Jan 16 07:36:30 host crontab[196388]: (hattmonk) LIST (username)
Jan 16 07:36:30 host crontab[196389]: (hattmonk) REPLACE (username)
Jan 16 07:36:30 host crontab[196391]: (hattmonk) LIST (username)
If you see those, that at least tells you the cron job is saving properly from the cPanel interface.

When the job is executed, you'll see the following entry:

Code:
Jan 16 07:37:01 host CROND[196416]: (hattmonk) CMD (your-cron-command-here)
Do you see that show up in the log file?
 

martin MHC

Well-Known Member
Sep 14, 2016
345
75
78
UK
cPanel Access Level
Root Administrator
Hi @cPRex thanks for the help there.

My cron's log last entry for this is:

Code:
Jan 16 00:15:01 basic CROND[4487]: (account) CMD (/usr/local/bin/php /home/account/crons/error_cleaner.php >/dev/null 2>&1)
And nothing since then. Expecting 0815 and 1215 (time here now is 1403)

The most recent records in this file are:

Code:
Jan 16 12:15:02 basic crontab[14752]: (account) LIST (account)
Jan 16 12:15:04 basic crontab[14872]: (account) LIST (account)
Which is the correct sort of time (hh:15) but may possibly be co-incidence of when I was exploring the issue.
 

martin MHC

Well-Known Member
Sep 14, 2016
345
75
78
UK
cPanel Access Level
Root Administrator
Also of interest is I'm seemingly unable to post messages on this forum containing / var / log / cron string (without spaces); with a popup saying forum has run into a problem