Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 have a script in cron.daily that runs at a certain time every morning. I need to change the time that it is run.

How do I change the time cron.daily runs the scripts?

share|improve this question

migrated from Sep 22 '12 at 21:46

This question came from our site for professional and enthusiast programmers.

On Red Hat-style systems, this is controlled in /etc/crontab.

By default, cron.daily scripts are run at 4:02. Editing this file will modify that time.

# 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

On Debian/Ubuntu systems, this is controlled in /etc/crontab as well.

For example; a default Ubuntu 12.04 installation:

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.


# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

And in either case, you may find more details about what syntax to use here: or by running man 5 crontab on almost any Linux system.

share|improve this answer

On openSUSE, the crontab looks like:

# check scripts in cron.hourly, cron.daily, cron.weekly, and cron.monthly
-*/15 * * * *   root  test -x /usr/lib/cron/run-crons && /usr/lib/cron/run-crons >/dev/null 2>&1

The run-crons command verifies the timestamps of the files in /var/spool/cron/lastrun among other things. When the time since the last execution expired, it will run the cron file again.

The time can be influented by touching the file. For example, to set it to 2012-11-17 03:15:

touch -t 201211140315 /var/spool/cron/lastrun/cron.daily
share|improve this answer

If the line wasn't there, this will not solve anything.

Try finding where cron.daily is mentioned, with

grep -R cron.daily /etc

Then take it from there.

share|improve this answer
You have to be very carefully if you use these command. For example for my RedHat it returns /etc/crontab and /etc/anacrontab files. And if you remove lines with cron.daily entry you just simply turn off execution of all scripts which should be run daily (for me it is logrotate, tmpwatch, cups and so on). – Lukasz Stelmach Aug 6 '10 at 9:28
I didn't suggest to remove the line, the question was where to modify the cron.daily time. This is how you locate it (so this was more a "help them help themselves" kind of answer) – mvds Aug 6 '10 at 9:34

You want to do two things:

  1. Remove the script from cron.daily and put in somewhere else.
  2. Add an entry to your crontab to run the specified script at the specified time:

00 10 * * * /path/to/script

share|improve this answer

Your Answer


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