]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/scripts/crontab.sh
bugfix: uses awk instead of cut for splitting query output (no more empty string)
[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=`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 | awk '{print $2}'`
15 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 | awk '{print $2}'`
16 ((DELTA=$CUR_TIME - $OLD_TIME))
17 if [ $DELTA -lt 0 ]; then
18   ((DELTA=$DELTA * -1))
19 fi
20 ((PERC=100 * $DELTA))
21 ((PERC=$PERC / $OLD_TIME))
22
23 if [ $PERC -ge 5 ]; then
24   cat <<EOT
25   REPORT FOR `date`
26   http://mowgli.cs.unibo.it/tassi/bench.php
27
28   PREFORMANCE LOSS DETECTED
29   is $CUR_TIME sec 
30   was $OLD_TIME sec
31
32 EOT
33 fi
34
35 CUR_FAIL=`echo "select count(distinct test) from bench where mark = \"$MARK\" and result = 'fail';" | mysql -u helm -h mowgli.cs.unibo.it matita | tail -n 1`
36 OLD_FAIL=`echo "select count(distinct test) from bench where mark = \"$LASTMARK\" and result = 'fail';" | mysql -u helm -h mowgli.cs.unibo.it matita | tail -n 1`
37
38 if [ $CUR_FAIL -gt $OLD_FAIL ]; then
39   cat <<EOT
40   REPORT FOR `date`
41   http://mowgli.cs.unibo.it/tassi/bench.php
42
43   MORE BROKEN TESTS DETECTED
44   now broken:
45   `echo "select distinct test from bench where mark = \"$MARK\" and result = 'fail';" | mysql -u helm -h mowgli.cs.unibo.it matita`
46   were broken:
47   `echo "select distinct test from bench where mark = \"$OLDMARK\" and result = 'fail';" | mysql -u helm -h mowgli.cs.unibo.it matita`
48   
49 EOT
50
51 fi
52
53 cd $OLD
54 rm -rf $TMPDIRNAME
55