views:

996

answers:

2

I'm putting a crontab job for updating with apt-get once a day (running Debian Lenny, there are updates almost daily). But almost all examples i've seen of this cron job invoke the -d flag.

This elicits 4 questions:

  • Why should I only download the packages and not install them?
  • Doesn't this defeat the purpose of running it automatically?
  • Don't I have to go in and actually install the updates later?
  • Is it safe for me to run the cron job without the -d flag?
+5  A: 

You're operating on a faulty assumption--neither apt-get (nor aptitude) are meant to be run automatically, nor is the Debian packaging system really designed for it. That's why the tools make it difficult.

What happens when a software upgrade breaks because you forgot to update a configuration file? This has happened to me in the past (apache2), and some with severe consequences that prevented the machine from booting (mdadm). What happens when the software brings in dependencies you don't want (i.e. bringing in the entire X11 windowing system, on a server)? Etc, etc...

If you're worried about installing security upgrades automatically, you want to look at the unattended-upgrades package. It will download and install packages from the security archive for you.

Samat Jain
thanks! that unattended-upgrades utility was nice.
contagious
+1  A: 

I run a Ubuntu server and have the following run as root once a week.

/usr/bin/apt-get update && /usr/bin/apt-get -s -u upgrade

The '-s' option tells apt-get to "simulate" updating the packages but not to actually do anything.
The net effect is I get an email (via cron) telling me what new packages are available.

I can then log in and run it by hand, taking the necessary precautions (backups etc) beforehand.

Hope this helps.

Darren Greaves