[CentOS] cron jobs not running

Tim Dunphy bluethundr at jokefire.com
Sun Jul 31 03:07:44 UTC 2011


hello list!!

I'm attempting to find out why this cron job isn't running. the host is centos 5.6 on i386 just so you know.


0       3       *       *       *       /bin/alldb  > /home/bluethundr/backupdb/alldb-$(date +%Y%m%d%H%S).sql

The job is meant to backup all the databases on a mysql server every day at 3 am. I have checked the backup directory and nothing is showing up for those days. 

I created the same job to run every minute but just like the job above the backups do not appear. 


*       *       *       *       * /bin/alldb  > /home/bluethundr/backupdb/alldb-$(date +%Y%m%d%H%S).sql


I have verified that the cron service is, indeed, running 

[root at VIRTCENT09:/home/bluethundr/backupdb] #service crond status
crond (pid  8053) is running...


However I do see the job is running in the cron logs


[root at VIRTCENT09:/home/bluethundr/backupdb] #tail /var/log/cron
Jul 30 22:59:01 VIRTCENT09 crond[8007]: (root) CMD (/bin/alldb  > /home/bluethundr/backupdb/alldb-$(date +)
Jul 30 22:59:46 VIRTCENT09 crond[8053]: (CRON) STARTUP (V5.0)
Jul 30 23:00:01 VIRTCENT09 crond[8074]: (root) CMD (/bin/alldb  > /home/bluethundr/backupdb/alldb-$(date +)
Jul 30 23:00:10 VIRTCENT09 crontab[8121]: (root) BEGIN EDIT (root)
Jul 30 23:01:01 VIRTCENT09 crond[8134]: (root) CMD (run-parts /etc/cron.hourly)
Jul 30 23:01:01 VIRTCENT09 crond[8135]: (root) CMD (/bin/alldb  > /home/bluethundr/backupdb/alldb-$(date +)
Jul 30 23:02:01 VIRTCENT09 crond[8157]: (root) CMD (/bin/alldb  > /home/bluethundr/backupdb/alldb-$(date +)
Jul 30 23:03:02 VIRTCENT09 crond[8265]: (root) CMD (/bin/alldb  > /home/bluethundr/backupdb/alldb-$(date +)
Jul 30 23:03:13 VIRTCENT09 crontab[8121]: (root) END EDIT (root)
Jul 30 23:04:01 VIRTCENT09 crond[8288]: (root) CMD (/bin/alldb  > /home/bluethundr/backupdb/alldb-$(date +)



Still nothing is appearing in the backup directory.

But if i run the command by hand it does work.

[root at VIRTCENT09:/home/bluethundr/backupdb] #/bin/alldb  > /home/bluethundr/backupdb/alldb-$(date +%Y%m%d%H%S).sql

And the file is created:




More information about the CentOS mailing list