Zionetrix::Git
Repositories
Help
Report an Issue
check_rc_upgrade
Code
Commits
Branches
Tags
Search
Tree:
1cec8ad
Branches
Tags
master
check_rc_upgrade
check_rc_upgrade.sh
Import initial
bn8
commited
1cec8ad
at 2010-05-11 07:48:45
check_rc_upgrade.sh
Blame
History
Raw
#!/bin/bash MAIL=root TIME=7 CACHE=/var/www/webmail/.cache_check_upgrade DEBUG=0 [ "$1" == "-v" ] && DEBUG=1 current=`egrep "define.*RCMAIL_VERSION" /var/www/webmail/public_html/program/include/iniset.php|sed "s/define('.*', '\([^']*\)'.*$/\1/"` [ $DEBUG -eq 1 ] && echo "Current : $current" newest=`wget -q http://www.roundcube.net/download -O - |grep Stable|sed 's/^.*Stable.*: \(.*\)<\/td>.*$/\1/'` [ $DEBUG -eq 1 ] && echo "Newest : $newest" if [ "$newest" != "$current" ] then tmp=`mktemp` echo "New RoundCude release" > $tmp echo "=====================" >> $tmp echo "Current : $current" >> $tmp echo "Newest : $newest" >> $tmp M=0 if [ -f $CACHE ] then if [ "`diff $tmp $CACHE`" != "" -o `find $CACHE -mtime +$TIME | wc -l` -eq 1 ] then [ $DEBUG -eq 1 ] && echo "Cache trop vieux ou modif => On envoi" M=1 else [ $DEBUG -eq 1 ] && echo "Pas de modif et cache trop recent : pas d'envoi" fi else [ $DEBUG -eq 1 ] && echo "Pas encore de cache => On envoi" M=1 fi if [ $M -eq 1 ] then cat $tmp > $CACHE cat $tmp | mail -s "New RoundCude release : $newest" $MAIL [ $DEBUG -eq 1 ] && echo "Mail envoyé" fi rm -f $tmp else [ $DEBUG -eq 1 ] && echo "Pas de changement de version" fi