[clug] monitoring number of updates available on debian/ubuntu

Jeremy Kerr jk at ozlabs.org
Mon Jul 19 23:12:34 MDT 2010

Hi Jeff,

> I'm looking for a means to tell how many packages, if any, are 
> available to be installed on a debian based system.

Ubuntu systems add this information to the motd:

 [jk at pororo ~]$ ssh localhost
 Linux pororo 2.6.32-23-generic #37-Ubuntu SMP Fri Jun 11 08:03:28 UTC 
 2010 x86_64 GNU/Linux 
 Ubuntu 10.04 LTS

 Welcome to Ubuntu!
  * Documentation:  https://help.ubuntu.com/

 0 packages can be updated.
 0 updates are security updates.

 [jk at pororo ~]$ 

The '0 packages..' data is added by a cron script, which essentially
does a:

 /usr/lib/update-notifier/apt_check.py --human-readable

This script is provided by the update-notifier-common package, but I
have a feeling this may be Ubuntu specific. It just uses the python
apt_pkg library to grab the number of updates, so should be fairly easy
to adapt to what you want to do.



More information about the linux mailing list