]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/scripts/crontab.sh
fix
[helm.git] / helm / matita / scripts / crontab.sh
1 #!/bin/bash
2 MARK=`date +%Y%m%d`
3 LASTMARK=`date -d yesterday +%Y%m%d`
4 TMPDIRNAME=.__${MARK}_crontab
5 CVSROOT=":ext:$USER@marcello.cs.unibo.it:/home/faculty/PROJECTS/cvs/helm"
6
7 OLD=$PWD
8 rm -rf $TMPDIRNAME 
9 mkdir $TMPDIRNAME
10 cd $TMPDIRNAME
11 cvs -d $CVSROOT co helm/matita/scripts 1>/dev/null 2>/dev/null
12 helm/matita/scripts/profile_cvs.sh 2> LOG
13
14 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;"`
15 OLD_TIME=`/usr/bin/php4 -c /etc/php4/apache/php.ini - shell_adder.php -- public_html/common.php  "select mark, SEC_TO_TIME(SUM(TIME_TO_SEC(time))) from bench where mark = \"$LASTMARK\" group by mark;"`
16
17 if [ -z "$CUR_TIME" -o -z "$OLD_TIME" ]; then
18   echo "No benchamks records for $MARK"
19   exit 1
20 fi
21
22 ((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`))
23 if [ $DELTA -lt 0 ]; then
24   PERC=0
25 else
26   ((PERC=100 * $DELTA))
27   ((PERC=$PERC / `/usr/bin/php4 -c /etc/php4/apache/php.ini - shell_time2cents.php -- public_html/common.php $OLD_TIME`))
28 fi
29 if [ $PERC -ge 5 ]; then
30   cat <<EOT
31   REPORT FOR `date`
32   http://mowgli.cs.unibo.it/~tassi/bench.php
33
34   PREFORMANCE LOSS DETECTED
35   is $CUR_TIME sec 
36   was $OLD_TIME sec
37
38 EOT
39 fi
40
41 CUR_FAIL=`/usr/bin/php4 -c /etc/php4/apache/php.ini - shell_adder.php -- public_html/common.php "select count(distinct test) from bench where mark = \"$MARK\" and result = 'fail';"`
42 OLD_FAIL=`/usr/bin/php4 -c /etc/php4/apache/php.ini - shell_adder.php -- public_html/common.php "select count(distinct test) from bench where mark = \"$LASTMARK\" and result = 'fail';"`
43
44 if [ $CUR_FAIL -gt $OLD_FAIL ]; then
45   cat <<EOT
46   REPORT FOR `date`
47   http://mowgli.cs.unibo.it/~tassi/bench.php
48
49   MORE BROKEN TESTS DETECTED
50   now broken:
51   `echo "select distinct test from bench where mark = \"$MARK\" and result = 'fail';" | mysql -u helm -h mowgli.cs.unibo.it matita`
52   were broken:
53   `echo "select distinct test from bench where mark = \"$LASTMARK\" and result = 'fail';" | mysql -u helm -h mowgli.cs.unibo.it matita`
54   
55 EOT
56
57 fi
58
59 cd $OLD
60 rm -rf $TMPDIRNAME
61