Reputation: 1191
It was working with no issues few months ago, and I can't remember any changes since then. /var/log/cron and Logwatch report both indicate that the scripts are being called, but actually nothing is executed.
cron.deny
file, only 'nobody' is there.My crontab:
root@server [~]# crontab -l -u my-username
SHELL="/sbin/nologin"
MAILTO=""
* * * * * /usr/local/bin/php -q /home/my-username/public_html/cron.php
*/2 * * * * /usr/bin/curl -m 240 -s http://full-path
*/3 * * * * /usr/bin/curl -m 240 -s http://full-path &>/dev/null
*/4 * * * * /usr/bin/curl http://full-path
*/5 * * * * /usr/bin/curl http://full-path
0 */12 * * * /usr/local/bin/php -q /home/my-username/public_html/path/to/script.php
Logs:
root@server [~]# tail -15 /var/log/cron
Jul 23 05:18:03 de CROND[18188]: (my-username) CMD (/usr/bin/curl -m 240 -s http://full-path &>/dev/null)
Jul 23 05:18:03 de CROND[18189]: (my-username) CMD (/usr/bin/curl -m 240 -s http://full-path)
Jul 23 05:18:03 de CROND[18190]: (my-username) CMD (/usr/local/bin/php -q /home/my-username/public_html/cron.php)
Jul 23 05:19:02 de CROND[18328]: (root) CMD ((sync;echo 1 >/proc/sys/vm/drop_caches;sync) >/dev/null 2>&1)
Jul 23 05:19:02 de CROND[18327]: (my-username) CMD (/usr/local/bin/php -q /home/my-username/public_html/cron.php)
Jul 23 05:20:02 de CROND[18479]: (my-username) CMD (/usr/local/bin/php -q /home/my-username/public_html/cron.php)
Jul 23 05:20:02 de CROND[18472]: (my-username) CMD (/usr/bin/curl -m 240 -s http://full-path)
Jul 23 05:20:02 de CROND[18477]: (root) CMD ((sync;echo 1 >/proc/sys/vm/drop_caches;sync) >/dev/null 2>&1)
Jul 23 05:20:02 de CROND[18474]: (root) CMD (/usr/local/maldetect/maldet --mkpubpaths >> /dev/null 2>&1)
Jul 23 05:20:02 de CROND[18473]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Jul 23 05:20:02 de CROND[18476]: (my-username) CMD (/usr/bin/curl http://full-path)
Jul 23 05:20:02 de CROND[18478]: (my-username) CMD (/usr/bin/curl http://full-path)
Jul 23 05:20:02 de CROND[18475]: (root) CMD (/usr/local/cpanel/bin/dcpumon >/dev/null 2>&1)
Jul 23 05:20:02 de CROND[18480]: (cacti) CMD (php /home/cacti/public_html/cacti/poller.php > /dev/null 2>&1)
Jul 23 05:20:02 de CROND[18481]: (root) CMD (LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok)
root@server [~]#
What else should I check? Running CentOS release 6.7 (Final)
Upvotes: 2
Views: 485
Reputation: 8550
Cron is only telling you that it tried to run the job, not the exit status.
In terms of what else you can do to help debug cron: Set cron's log level way up with -L 15
. You can set this in /etc/defaults/cron
, with line EXTRA_OPTS='-L 15'
. Then restart - sudo service cron restart
. Your logs will now show something like this on errors:
Jul 23 11:45:01 localhost CRON[3565]: (CRON) error (grandchild #3566 failed with exit status 127)
Beyond that:
SHELL="/sbin/nologin"
looks suspect. Does that work? Try removing it.MAILTO
to your local mail box MAILTO=dave
(or just unsetting it from empty string) and checking your mail, or just piping the output of your scripts to a log, might also help debug the situation.Upvotes: 1