clean kernel parsing.
[monitor.git] / automate_pl03.sh
1 #!/bin/bash
2
3 set -e
4 cd $HOME/monitor/
5 DATE=`date +%Y-%m-%d-%T`
6
7
8 if [ -f $HOME/monitor/SKIP ] ; then 
9         echo "SKIPPING Monitor"
10         # TODO: should be possible to kill the old version if 
11         # desired and prevent lingering instances of automate.
12         #./kill.cmd.sh `cat $HOME/monitor/SKIP`
13         exit
14 else
15         echo $$ > $HOME/monitor/SKIP
16 fi
17 #########################
18 # 1. FINDBAD NODES 
19 rm -f pdb/production.findbad2.pkl
20 ./findbad.py --cachenodes --debug=0 --dbname="findbad2" $DATE
21
22 ########################
23 # COPY to golf for diagnose.py and action.py
24 cp pdb/production.findbad2.pkl pdb/production.findbad.pkl
25 #scp pdb/production.findbad2.pkl soltesz@golf.cs.princeton.edu:monitor3/pdb/production.findbad.pkl
26
27 ########################
28 # COPY Act_all records
29 #scp soltesz@golf.cs.princeton.edu:monitor3/pdb/production.act_all.pkl pdb/
30
31 ########################
32 # badcsv.txt
33 ./printbadcsv.py  | grep -v loading | tr -d ' ' > badcsv.txt
34 cp badcsv.txt /plc/data/var/www/html/monitor/
35
36 #########################
37 # 2. FINDBAD PCUS
38 rm -f pdb/production.findbadpcus2.pkl
39 ./findbadpcu.py --increment --refresh --debug=0 --dbname=findbadpcus2 $DATE             
40 # convert pkl to php serialize format.
41 cp pdb/production.findbadpcus2.pkl pdb/production.findbadpcus.pkl
42 ./pkl2php.py -i findbadpcus2 -o findbadpcus
43
44 ./pkl2php.py -i act_all -o act_all
45 ./pkl2php.py -i plcdb_hn2lb -o plcdb_hn2lb
46 ./pkl2php.py -i findbad -o findbadnodes
47 ./pkl2php.py -i ad_dbTickets -o ad_dbTickets
48 ./pkl2php.py -i idTickets -o idTickets
49
50 for f in findbad act_all findbadpcus l_plcnodes; do 
51         cp pdb/production.$f.pkl archive-pdb/`date +%F`.production.$f.pkl
52 done
53
54 rm -f $HOME/monitor/SKIP