A few changes to improve upon the script:
[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 # 1. FINDBAD NODES 
9 rm -f pdb/production.findbad2.pkl
10 ./findbad.py --cachenodes --debug=0 --dbname="findbad2" $DATE
11
12 ########################
13 # COPY to golf for diagnose.py and action.py
14 cp pdb/production.findbad2.pkl pdb/production.findbad.pkl
15 #scp pdb/production.findbad2.pkl soltesz@golf.cs.princeton.edu:monitor3/pdb/production.findbad.pkl
16
17 ########################
18 # COPY Act_all records
19 #scp soltesz@golf.cs.princeton.edu:monitor3/pdb/production.act_all.pkl pdb/
20
21 ########################
22 # badcsv.txt
23 ./printbadcsv.py  | grep -v loading | tr -d ' ' > badcsv.txt
24 cp badcsv.txt /plc/data/var/www/html/monitor/
25
26 #########################
27 # 2. FINDBAD PCUS
28 rm -f pdb/production.findbadpcus2.pkl
29 ./findbadpcu.py --increment --refresh --debug=0 --dbname=findbadpcus2 $DATE             
30 # convert pkl to php serialize format.
31 cp pdb/production.findbadpcus2.pkl pdb/production.findbadpcus.pkl
32 ./pkl2php.py -i findbadpcus2 -o findbadpcus
33
34 ./pkl2php.py -i act_all -o act_all
35 ./pkl2php.py -i plcdb_hn2lb -o plcdb_hn2lb
36 ./pkl2php.py -i findbad -o findbadnodes
37 ./pkl2php.py -i ad_dbTickets -o ad_dbTickets
38 ./pkl2php.py -i idTickets -o idTickets
39
40 for f in findbad act_all findbadpcus l_plcnodes; do 
41         cp pdb/production.$f.pkl archive-pdb/`date +%F`.production.$f.pkl
42 done