Import initial
This commit is contained in:
commit
1cec8ada0c
1 changed files with 48 additions and 0 deletions
48
check_rc_upgrade.sh
Executable file
48
check_rc_upgrade.sh
Executable file
|
@ -0,0 +1,48 @@
|
|||
#!/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
|
Loading…
Reference in a new issue