At work we run a number of Red Hat Enterprise machines and CentOS servers. After finding a large number of machines that were grossly outdated I decided to add a weekly cron job to notify us of available updates. I used something along the lines of:
yum check-update | mail -s “Weekly Errata Report for $(hostname)” firstname.lastname@example.org
After dropping this little one-liner into /etc/cron.weekly/ we’re now notified of available package updates on a weekly basis, and our machines are keeping up to date much better!
I got to thinking this evening about how to achieve the same results on my Ubuntu and Debian servers. There does not seem to be an equivalent command to ‘yum check-update‘, but there appears to be a similar solution.
(apt-get update && apt-get -s safe-upgrade && apt-get -s full-upgrade) | mail -s “Weekly Errata Report for $(hostname)” email@example.com
The apt-get equivalent command above is a bit more verbose but it basically does the same thing. note: the parens are required so that the collective output of the three commands will be piped to the mail utility.
Does anyone else have any suggestions an how to accomplish this with standard Ubuntu/Debian tools?