Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created a new file "dbbackup" in /etc/cron.daily that contains a simple database backup script.


mysqldump -h localhost -u user -p'passord' database_name > /var/www/sites/"`eval date +%u%m%Y`".sql

Now the problem is that this file is not being automatically run, I am fairly new to linux servers but from reading around I found that this is the location that you need to create your cron scripts, but for some reason it doesn't run it, maybe I need to tell CRON some how to run this file in the terminal does anyone know?


share|improve this question
up vote 3 down vote accepted

A few things to do/check

  • add a full path to mysqldump - /usr/bin/mysqldump ...
  • ensure that the file's user/group ownership is root:root

Look in /var/log/cron for error messages. The run parts script logs messages like

Oct 15 03:33:02 centos6 run-parts(/etc/cron.daily)[21777]: starting mlocate.cron
Oct 15 03:33:02 centos6 run-parts(/etc/cron.daily)[21948]: finished mlocate.cron

at the start and end of each job.

From the comments - it appears that cron was not running.

  • Check cron is running - service crond status and start if required service crond start
share|improve this answer
Hi @Iain my con log only contains crontab cron jobs and no cron.daily. Example: Sep 28 15:33:28 servername crontab[13164]: (root) LIST (root) – Alex Oct 15 '12 at 11:32
@Alex: grep daily /var/log/cron – Iain Oct 15 '12 at 11:39
this returns an empty result – Alex Oct 15 '12 at 11:46
@Alex: You have no other daily jobs then ? – Iain Oct 15 '12 at 11:54
There are default cron jobs in the cron.daily folder like "logrotate" and "makewhatis.cron" but looking at the cron log they dont run, so maybe the cron doesn't run the cron.daily cron jobs and they need to be setup. Any idea if this is configurable using the terminal commands or there is a config file for this? – Alex Oct 15 '12 at 13:10

Please make sure that the file is executable:

chmod +x /etc/cron.daily/dbbackup
share|improve this answer
Hi @zero_r yes that file was executable. – Alex Oct 15 '12 at 11:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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