Keep Up To Date Your Linux Server With Cron

Everyday tasks for any administrator includes keeping the various networking equipment up to date which is a repetitive process consuming unnecessary amounts of time. This simple crontab will check for updates everyday in my case I have an Ubuntu server.

First let’s become root in order to edit the crontab.

sudo crontab -e

Cron can very easy to set up, here is my automatic update / upgrade example.


# Check for updates at 6:30 everyday
30 18 * * * apt-get -qq update && apt-get -qq –simulate upgrade

Let me explain that the “MAILTO” line will send an email only if an upgrade becomes available, the server will check for updates and upgrades at 6:30. If you don’t have a mail server I recommend installing Postfix for outgoing email only.

If you run Ubuntu 6.06 LTS you won’t get many emails.