0

I created a dummy entry in /etc/crontab, but it doesn't get executed according to cron log /var/log/cron:

Feb  7 08:20:01 localhost CROND[22781]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Feb  7 08:30:01 localhost CROND[23132]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Feb  7 08:40:01 localhost CROND[23137]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Feb  7 08:50:01 localhost CROND[23147]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Feb  7 09:00:01 localhost CROND[23922]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Feb  7 09:01:01 localhost CROND[23977]: (root) CMD (run-parts /etc/cron.hourly)
Feb  7 09:01:01 localhost run-parts(/etc/cron.hourly)[23977]: starting 0anacron
Feb  7 09:01:01 localhost run-parts(/etc/cron.hourly)[23986]: finished 0anacron
Feb  7 09:10:01 localhost CROND[24264]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Feb  7 09:20:01 localhost CROND[24295]: (root) CMD (/usr/lib64/sa/sa1 1 1)

/etc/crontab

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

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed

05 20 * * * root /data/CENTRAL_BACKUP/xxx.sh

the OS is centos

5
  • Your definition says to run it at 20:05; your logs do not cover that period. What time did you expect it to run at? Feb 13, 2015 at 4:53
  • that's the end of the cron log, it means that nothing is logged to it since Feb 7th.
    – user12145
    Feb 13, 2015 at 5:25
  • 1
    what are the permissions on the script? also did you manually edit /etc/crontab or did you use the crontab -e command?
    – Gravy
    Feb 13, 2015 at 6:07
  • Is your syslog daemon still running? Feb 13, 2015 at 6:36
  • Very likely is crontab newline problem. Add empty line at the end. serverfault.com/a/230407/41072
    – titus
    Feb 13, 2015 at 9:26

2 Answers 2

0

Have you tried turning the service off then back on again? I came across a similar issue not too long ago configuring a backup script for our wiki server. You have to restart the service to get it to load the new configuration, so if you haven't already, try that.

service cron restart

or

/etc/init.d/cron restart
0

it turned out that my system was messed up by selinux because I symlinked /var to another parition and selinux has permission issue with it. I had to grant permission 777 to the symlink /var(not the data). and then everything works.

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.