[wplug] [wplug-announce] The Open Pitt, Issue 16
Kevin Squire
gentgeen at linuxmail.org
Fri Sep 30 14:31:43 EDT 2005
On Fri, 30 Sep 2005 11:25:39 -0600 (MDT)
Vance Kochenderfer <vkochend at nyx.net> wrote:
> Debian
> Debian users love to point out that simply typing "apt-get update &&
> apt-get upgrade" at a root prompt will bring your system up to date.
> Another option is Aptitude, a menu-driven (but still text-based)
> program that can handle all aspects of package management. If you'd
> rather point and click, Synaptic provides an easy-to-use graphical
> interface.
> Additional helpful tips can be found at
> <http://www.debian-administration.org/articles/241>.
To add my own two cents:
I have the following script run daily on my Debian boxes. Then if there
are any updates, it shows up in my email. I would love to give credit
to where I found it, but I forgot to note it in the script, and of
course, now I don't remember.
BEGIN SCRIPT:
#!/bin/bash
#
# Script to produce an email whenever system needs updated
# line added to /etc/crontab to run this at 4:00 AM daily
#
# Update the package cache but don't spit anything out to stdout or
stderr;
# that way, if there's nothing to update we won't get a pointless mail
from
# cron ...
apt-get update 2>&1 > /dev/null
# Do a "trial" run of updating our packages (note the -s switch).
apt-get
# will report something along the lines of ...
#
# n packages upgraded, n newly installed, n to remove and n not upgraded
#
# Strip out the number of packages to upgrade via a bit of grepery and
# awkery ...
report=`apt-get -s upgrade | grep '^[0-9]\{1,\} upgraded'`
if [[ -z "$report" ]]; then
exit 0 # Move on - there's nothing to do here
fi
to_upgrade=`echo $report | awk -F, '{print $0}' | awk '{print $1}' `
if [[ $to_upgrade -gt 0 ]]; then
# We've got potential packages to upgrade, spit out our original
# message from apt-get upgrade to force a mail to be sent for this
# cron job ...
echo "$report"
fi
exit 0
END SCRIPT
So now I don't have to worry about remembering to upgrade, just wait
till I get an email from cron :-)
Kevin
--
*****************************************************************
Associate yourself with men of good quality if you esteem
your own reputation; for 'tis better to be alone then in bad
company. - George Washington, Rules of Civility
More information about the wplug
mailing list