Bookmark and Share

Debian automatic updates with cron-apt

Everybody knows that keeping an intenet-connected server’s software packages up to date is essential, but it’s easy to forget performing such a mechanical task regularly. Cron-apt is simple and effective cure.

First, install cron-apt:

aptitude install cron-apt

Then, adjust the setup file /etc/cron-apt/config. You may want to change the command to be used to aptitude instead of apt-get by editing relevant setting:


And perhaps change the mail address to something else than root (although, you really ought to have all root mails to be forwarded to a real person):


And then there’s the setting to send mail when there’s something to install, instead of only on errors:


Other settings should be fine as they are by default. The time of action can be configured from /etc/cron.d/cron-apt. By default it’s 4 o’clock every night, plus there’s a one-hour random component defined in /etc/cron-apt/config, to avoid package server overload from zillion simultaneous connections from all that time zone’s cron-apt users.

That’s pretty much it! You still need to install the updates manually every now and then:

aptitude safe-upgrade

but you get notified by mail when you need to do so, i.e. when there’s something to install. So no more fruitless apt sessions only to find that there’s no news this time (or worse, suddenly realizing that you’ve not updated your box for a few months now…)

Completely automating the process is tempting, but it would be a bad idea: should something go wrong, you wouldn’t be around to fix it. Automatic downloading and notifying is the golden path.

Last modified: 2009-10-11 14:07 +0300

blog comments powered by Disqus