X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fmatita%2Fscripts%2Fcrontab.sh;h=ee7c181dbd1e0be73f11f4bbad039b6fdedc7bec;hb=4167cea65ca58897d1a3dbb81ff95de5074700cc;hp=926a9750c8ff510a9e5dc61b471b608ea476ffc6;hpb=974deb534307c34492b516999d09c409ff570bb8;p=helm.git diff --git a/helm/matita/scripts/crontab.sh b/helm/matita/scripts/crontab.sh index 926a9750c..ee7c181db 100644 --- a/helm/matita/scripts/crontab.sh +++ b/helm/matita/scripts/crontab.sh @@ -1,49 +1,70 @@ -MARK=`date +%Y%m%d` -LASTMARK=`date -d yesterday +%Y%m%d` -TMPDIRNAME=.__${MARK}_crontab +#!/bin/bash +TODAY=`date +%Y%m%d` +YESTERDAY=`date -d yesterday +%Y%m%d` +TMPDIRNAME=.__${TODAY}_crontab CVSROOT=":ext:$USER@marcello.cs.unibo.it:/home/faculty/PROJECTS/cvs/helm" +SHELLTIME2CENTSPHP=helm/matita/scripts/shell_time2cents.php +SHELLADDERPHP=helm/matita/scripts/shell_adder.php +COMMONPHP=helm/matita/scripts/public_html/common.php OLD=$PWD rm -rf $TMPDIRNAME mkdir $TMPDIRNAME cd $TMPDIRNAME -#cvs -d $CVSROOT co helm/matita/scripts 1>/dev/null 2>/dev/null -#helm/matita/scripts/profile_cvs.sh 2> LOG +cvs -d $CVSROOT co helm/matita/scripts 1>/dev/null 2>/dev/null +helm/matita/scripts/profile_cvs.sh 2> LOG -CUR_TIME=`echo "select mark, SUM(TIME_TO_SEC(time)) from bench where mark = \"$MARK\" group by mark;" | mysql -u helm -h mowgli.cs.unibo.it matita | tail -n 1 | cut -f 2` -OLD_TIME=`echo "select mark, SUM(TIME_TO_SEC(time)) from bench where mark = \"$LASTMARK\" group by mark;" | mysql -u helm -h mowgli.cs.unibo.it matita | tail -n 1 | cut -f 2` -((DELTA=$CUR_TIME - $OLD_TIME)) -if [ $DELTA -lt 0 ]; then - ((DELTA=$DELTA * -1)) +MARK=`echo "select distinct mark from bench where mark like '$TODAY%' order by mark" | mysql -u helm matita | tail -n 1` +LASTMARK=`echo "select distinct mark from bench where mark like '$YESTERDAY%' order by mark" | mysql -u helm matita | tail -n 1` + +if [ -z "$MARK" ]; then + echo "No benchmark records for $TODAY" + exit 1 +fi + +if [ -z "$LASTMARK" ]; then + echo "No benchmark records for $YESTERDAY" + exit 1 fi -((PERC=100 * $DELTA)) -((PERC=$PERC / $OLD_TIME)) +CUR_TIME=`/usr/bin/php4 -c /etc/php4/apache/php.ini -f $SHELLADDERPHP -- $COMMONPHP "select SEC_TO_TIME(SUM(TIME_TO_SEC(time))) from bench where mark = \"$MARK\" group by mark;"` +OLD_TIME=`/usr/bin/php4 -c /etc/php4/apache/php.ini -f $SHELLADDERPHP -- $COMMONPHP "select SEC_TO_TIME(SUM(TIME_TO_SEC(time))) from bench where mark = \"$LASTMARK\" group by mark;"` + +CUR_CENTS=`/usr/bin/php4 -c /etc/php4/apache/php.ini -f $SHELLTIME2CENTSPHP -- $COMMONPHP $CUR_TIME` +OLD_CENTS=`/usr/bin/php4 -c /etc/php4/apache/php.ini -f $SHELLTIME2CENTSPHP -- $COMMONPHP $OLD_TIME` + +((DELTA=$CUR_CENTS-$OLD_CENTS)) +if [ $DELTA -lt 0 ]; then + PERC=0 +else + ((PERC=100 * $DELTA)) + ((PERC=$PERC / $OLD_CENTS)) +fi if [ $PERC -ge 5 ]; then cat <