Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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 want to setup a cron job to download up-to-date package only at night. But I found that the cron.daily jobs will be run by anacron if it's installed, so if my computer fails to wake-up at night to do the job, it will run the next time I turn it on.

How configure my system to run /etc/cron.daily/apt exclusively with cron (i.e. at and only at the specified time)?

This is my /etc/crontab

# 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 )
share|improve this question

Move your script out of /etc/cron.daily and add an entry for it directly in /etc/crontab. For example, you could move it to /usr/local/sbin/cron-apt and then add this entry to /etc/crontab:

0 5 * * * root /usr/local/sbin/cron-apt

This will give you fine control of the exact timing of your job as well. The command man 5 crontab will give you more information on the crontab format.

share|improve this answer

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.