X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fmatita%2Fscripts%2Fcrontab.sh;h=5ad50de5ee47ea77bb1a997c1fb067a5752ba4e8;hb=771ee8b9d122fa963881c876e86f90531bb7434f;hp=f1f28356cd13736a6a767a9f61ae607563d5a7d9;hpb=2d8c6b98436ec14fbee75414e76317313bb6b2ed;p=helm.git diff --git a/helm/matita/scripts/crontab.sh b/helm/matita/scripts/crontab.sh index f1f28356c..5ad50de5e 100644 --- a/helm/matita/scripts/crontab.sh +++ b/helm/matita/scripts/crontab.sh @@ -1,52 +1,69 @@ #!/bin/bash -MARK=`date +%Y%m%d` -LASTMARK=`date -d yesterday +%Y%m%d` -TMPDIRNAME=.__${MARK}_crontab -CVSROOT=":ext:$USER@marcello.cs.unibo.it:/home/faculty/PROJECTS/cvs/helm" +TODAY=`date +%Y%m%d` +YESTERDAY=`date -d yesterday +%Y%m%d` +TMPDIRNAME=$HOME/__${TODAY}_crontab +TMPDIRNAMEOLD=$HOME/__${YESTERDAY}_crontab +SVNROOT="svn+ssh://mowgli.cs.unibo.it/local/svn/helm/trunk/" +SHELLTIME2CENTSPHP=scripts/shell_time2cents.php +SHELLADDERPHP=scripts/shell_adder.php +COMMONPHP=scripts/public_html/common.php + OLD=$PWD -rm -rf $TMPDIRNAME -mkdir $TMPDIRNAME +mkdir -p $TMPDIRNAME +rm -rf $TMPDIRNAMEOLD cd $TMPDIRNAME -cvs -d $CVSROOT co helm/matita/scripts 1>/dev/null 2>/dev/null -helm/matita/scripts/profile_cvs.sh 2> LOG +rm -rf helm +svn co ${SVNROOT}helm/matita/scripts/ > LOG.svn 2>&1 +scripts/profile_svn.sh 2> LOG + +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` -CUR_TIME=`/usr/bin/php4 -c /etc/php4/apache/php.ini - shell_adder.php -- public_html/common.php "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 - shell_adder.php -- public_html/common.php "select SEC_TO_TIME(SUM(TIME_TO_SEC(time))) from bench where mark = \"$LASTMARK\" group by mark;"` +if [ -z "$MARK" ]; then + echo "No benchmark records for $TODAY" + exit 1 +fi -if [ -z "$CUR_TIME" -o -z "$OLD_TIME" ]; then - echo "No benchamks records for $MARK" +if [ -z "$LASTMARK" ]; then + echo "No benchmark records for $YESTERDAY" exit 1 fi -((DELTA=`/usr/bin/php4 -c /etc/php4/apache/php.ini - shell_time2cents.php -- public_html/common.php $CUR_TIME` - `/usr/bin/php4 -c /etc/php4/apache/php.ini - shell_time2cents.php -- public_html/common.php $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 / `/usr/bin/php4 -c /etc/php4/apache/php.ini - shell_time2cents.php -- public_html/common.php $OLD_TIME`)) + ((PERC=$PERC / $OLD_CENTS)) fi if [ $PERC -ge 5 ]; then cat <