check_update

Voici mon script permettant de verifier si une nouvelle version d'un logiciel est sorti. Rien de bien sorcier, un cron tous les jours qui vérifie le MD5 de la page internet de la page de téléchargement.

Le fichier : /etc/cron.daily/check_update

#!/bin/bash

rm -f /tmp/mail.log

check_mail()
{
mail -s "Info check_mail" gnunux@gnunux.info < /tmp/mail.log
}

check()
{
cd /tmp
FILE=$0.tmp
PAGE="$1"
MD5="$2"
wget --quiet "$PAGE" -O $FILE
if [ "$?" = "0" ]
then
MD5SUM=`md5sum $FILE`
[ ! "${MD5SUM%% *}" = "$MD5" ] && echo "New version of this page : $PAGE with md5 : ${MD5SUM%% *}" >> /tmp/mail.log
else
echo "cannot download this page" >> /tmp/mail.log
fi
}

source /etc/check_update.conf

[ -r /tmp/mail.log ] && check_mail && rm /tmp/mail.log

Le fichier : /etc/check_update.conf

check http://www.incava.org/projects/apercu/download.html fe0001331ce327fcd3dca8e73b728d02
check http://goupil.tuxfamily.org/downloads/ b20adc7841c02ca0415adae655e82267

Haut de page