3

My server is CentOS 5. When I edit /etc/crontab or edit any user(including root) crontab via "crontab -e" command, it just adds "(system) RELOAD (/etc/crontab)" or "(admin) RELOAD (cron/admin)" in the log. No CMD in the /var/log/cron.

Sample entry in /var/log/cron:

Aug 10 10:21:33 localhost crontab[31688]: (root) BEGIN EDIT (root)
Aug 10 10:21:42 localhost crontab[31688]: (root) REPLACE (root)
Aug 10 10:21:42 localhost crontab[31688]: (root) END EDIT (root)
Aug 10 10:22:01 localhost crond[2688]: (root) RELOAD (cron/root)

Result of "service crond status":

crond (pid 1345) is running...

The command "cat /var/log/messages | grep cron" does not give anything.

Contents of /etc/cron.allow:

admin
root

Contents of /etc/crontab:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
* * * * * root run-parts /bin/date >> /data/date.txt

Result of ps aux |grep cron:

root      1345  0.0  0.1   5268  1204 ?        Ss   11:43   0:00 crond

Contents of admin's crontab:

* * * * * /bin/date >> /data/date.txt

Note that it's not only admin's crontab that's not running. All cron jobs are not running.

Any ideas why they aren't running?

11
  • try cat /var/log/messages | grep -i cron
    – coredump
    Aug 10, 2010 at 3:32
  • try tail -f /var/log/cron
    – Prix
    Aug 10, 2010 at 3:53
  • @coredump - as I said above, nothing displays. @Prix - see above(Sample entry in /var/log/cron: section).
    – ian
    Aug 10, 2010 at 4:24
  • No emails either? Nothing in /data/date.txt? Have you tried kill -HUP 1345? Aug 10, 2010 at 5:19
  • @dennis - sorry no emails for root. I tried your command but still no date.txt after waiting for 15mins.
    – ian
    Aug 10, 2010 at 6:03

4 Answers 4

2

Check you don't have a /etc/cron.allow file or /etc/cron.deny file causing jobs to be ignored.

If /etc/cron.allow is not there then everyone can run cron jobs. If it is there but empty I am not sure if that allows anyone to run cron jobs.

2

The is an error in your crontab, look at:

 * * * * * root run-parts /bin/date >> /data/date.txt

You invoke run-parts with the directory /bin/date - surely this will fail. The error goes to stderr and isn't cached by >>

0

Create the file named /etc/cron.allow if it doesn't exist and add the username to it.

0

Although answer has been accepted for this question, I will like to add what worked for me. it's a good idea to quote the URL, if it contains a query it may not work without everything being quoted.

DONT FORGET TO PUT YOUR URL WHICH CONTAINS "?, =, #, %" IN A QUOTE.

Example. https://paystack.com/indexphp?docs/api/#transaction-charge-authorization&date=today should be in a quote like so "https://paystack.com/indexphp?docs/api/#transaction-charge-authorization&date=today"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.