Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

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.