I have capped data which is essentially free between midnight and 5am. As a result, I would like to set Ubuntu to automatically download updates over that time. It seems that cron-apt is what I need, but the documentation and syntax is sketchy and unintuitive. Can anyone tell me how to use it to schedule downloads?

It can install the updates at the same time as far as I'm concerned, but that's not such a big issue - I can run those at a later stage.


Actually the documentation of cron-apt is pretty thorough. You can find the documentation and examples in /usr/share/doc/cron-apt. If you don't intent to read it, you can easily just set up a root cronjob yourself (without using cron-apt).

You can open the crontab of the root-user with sudo crontab -e. Now just add something like this:

# m h  dom mon dow   command
0   1  *   *   *     /usr/bin/apt-get update && /usr/bin/apt-get -y dist-upgrade

Make sure there is an empty line at the end of the file and save it. The dist-upgrade makes sure, that upgrade go through, even packages need to be removed to install upgrades to other packages. If you don't want to risk that, leave it at upgrade. If you add the -d option to the upgrade command, packages will only be downloaded and not installed. Check out man apt-get for more options.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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