How to Change the Timing of Cron.daily

Cron is a Linux daemon that runs specified programs at precise times throughout the day, week, month, or even year. You can setup a cron job to automate any tasks on your server. Cron.daily is a directory on some Linux servers that runs all scripts or links to scripts within it at the same time every day. Similarly, cron.hourly, cron.weekly, and cron.monthly run scripts at their appointed times.

Depending on your Linux distribution, cron.daily will execute commands some time in the early morning. These commands may include logrotate and mlocate, two scripts that can be resource-intense. If you study your website traffic, you may find that these processes are running during high traffic times, especially if you have websites with many international visitors. Fortunately, you can change the time when cron.daily runs.

To change the timing, edit the crontab file located at /etc/crontab.

It will look something like this:


# 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 )

In this example, cron.daily runs at 6:25 AM every day. If you wanted to change it to 2:00 AM, you would change the “m” column to “00” and the “h” column to “2”. Save the file, and exit. The next day, cron.daily will run at the new time.