[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cobalt-security] Security Updates 04/05/2001



> I found exactly the same thing - joined here as I've no time 
> to check that
> site every hour of the day..

That is why I wrote this script (cron it as often as suits your needs):

#!/bin/sh

####################################
# File:   checkupdates
# Author: Reinoud van Leeuwen (reinoud.v@xxxxxxxxxxxxx)
# $Revision: 1.1 $
# Desc:   Check the patches download page to see if it has
#         Changed, and mail sombody that new patches might
#         have appeared.
#
# $Log: checkupdates,v $
# Revision 1.1  2001/03/06 12:30:16  root
# Initial revision
#
####################################

# change email address to the address of the Cobalt administrator
#
export EMAIL=youraddress@xxxxxxxxxxxxxxx

# You will probably have to change nothing from here
#
export TESTDIR=~/checkupdates.dir
export TESTFILE=$TESTDIR/checkupdatepage.keep
export LOG=$TESTDIR/checkupdates.log
export URL=http://pkg.nl.cobalt.com/
export LYNX=/usr/bin/lynx

TMPFILE=`mktemp -q /tmp/$0.XXXXXX`
if [ $? -ne 0 ]; then
  echo "$0: Can't create temp file, exiting..."
  exit 1
fi

if [ ! -d $TESTDIR ]; then
    mkdir -p $TESTDIR
fi

if [ ! -e $LOG ]
then
  touch $LOG
fi

export TIME=`date`

$LYNX -dump $URL > $TMPFILE

if [ -e $TESTFILE ]
then
  diff $TMPFILE $TESTFILE > /dev/null
  if  [ $? -eq 1 ]
  then
    # files different -> web page has changed!
    echo "check $URL (brought to you by $0 on `hostname`)" | \
      mail -s "new updates available? (Web page $URL has changed)" $EMAIL
    echo "$TIME  STATUS CHANGED! (mailed to $EMAIL)" >> $LOG
  else
    echo "$TIME  nothing changed" >> $LOG
  fi
fi
cp $TMPFILE $TESTFILE
rm $TMPFILE