On 9 February 2011 12:37, woolsherpahat <[email protected]> wrote:
>>> On 6 February 2011 05:23, Alessandro Baggi <[email protected]> 
>>> wrote:
>>> Hi List, i had registered me to the security list:
>>> [email protected] since 9 Genuary 2011, but any email come on my
>>> account. Some that had security list subscribtion, can tell me if since
>>> 09/01/2001 at today there are mails?
>>
>> I use a script which scrapes http://www.openbsd.org/errata48.html
>> daily and emails me the changes as they occur.
>>
>>
>> Shane
>
> That sounds pretty cool... any chance you would be willing to share?

Okay, I'm probably not doing this the best way, so as embarrassing as
this is, it might hopefully get improved by someone...

#!/bin/sh
#
# OpenBSD_errata48.sh
#
# Check for any changes to the OpenBSD 4.8 Errata list and email
# an alert if so.


# Move the lastest successful OpenBSD errata grab so that is becomes
# the previous successful grab.

mv /home/scripts/OpenBSD_errata48_latest.txt \
   /home/scripts/OpenBSD_errata48_previous.txt

# Use lynx to just output to stdout the text of the OpenBSD Errata
# page, without a URL list.  Output the status to an error file so
# that sending bogus emails due to server being unavailable does not
# occur.
#
# Then filter out everything but the errata detail lines and output
# to a temporary file that will only be used if the web server status
# is "200 OK".

lynx -dump -nolist -error_file=/home/scripts/OBSD_errata48_err.txt \
 http://www.openbsd.org/errata48.html | egrep "^     \* ?|       ?" \
 > /home/scripts/OpenBSD_errata48_current.txt

# Check the error status file to make sure the file was successfully
# retrieved.  If successful, procede with comparison between the
# current and previous errata, to determine whether an email should
# be sent.

if egrep " 200 OK" /home/scripts/OBSD_errata48_err.txt
then
    mv /home/scripts/OpenBSD_errata48_current.txt \
       /home/scripts/OpenBSD_errata48_latest.txt
    if ! diff /home/scripts/OpenBSD_errata48_latest.txt \
              /home/scripts/OpenBSD_errata48_previous.txt > /dev/null
    then
        diff /home/scripts/OpenBSD_errata48_latest.txt \
             /home/scripts/OpenBSD_errata48_previous.txt \
             | egrep "^\<" | sed 's/\<      //g' \
             | tr -d "\n" | perl -pe 's/\* /\n\n/g' \
             | sed 's/  */ /g' \
             | mail -s "OpenBSD 4.8 Errata!" [email protected]
    fi
else rm /home/scripts/OpenBSD_errata48_current.txt
fi

rm /home/scripts/OBSD_errata48_err.txt

Reply via email to