[Gllug] Firewall Setup Script
Jon Dye
jon at pecorous.co.uk
Thu Oct 2 11:27:42 UTC 2003
Richard Smith wrote:
[...]
> Quickie no 2: apt-get install cron-apt - which runs apt-get update daily
> (which downloads packages too) and all you need to do is apt-get upgrade
> on a daily basis and your server is updated.
I use a home made script for this which only emails me when there are
any updates to do which I thought I'd share. I've put the following in
/etc/cron.daily/check_for_updates:
>#!/bin/bash
>
>export PATH=/bin:/usr/bin
>
>TMPFILE=`mktemp`
>trap "rm $TMPFILE" EXIT # clearup tempfile on exit
>
>aptitude update > /dev/null && \
> aptitude --assume-yes --simulate upgrade > "$TMPFILE"
>
>if [ -s "$TMPFILE" ]; then
> NUM_UPGRADES=`grep "packages upgraded" "$TMPFILE" | cut -d " "
-f 1`
> if [ $NUM_UPGRADES -gt 0 ]; then
> cat "$TMPFILE"
> fi
>else
> echo "An error occured while checking for updates:"
> echo
> cat "$TMPFILE"
>fi
JD
--
Gllug mailing list - Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug
More information about the GLLUG
mailing list