a template for a tool that will spit out the configuration for a node to see
[monitor.git] / automate_pl03.sh
index 82f25dc..e31ead9 100755 (executable)
@@ -6,14 +6,19 @@ DATE=`date +%Y-%m-%d-%T`
 
 
 if [ -f $HOME/monitor/SKIP ] ; then 
-       echo "SKIPPING Monitor"
        # TODO: should be possible to kill the old version if 
        # desired and prevent lingering instances of automate.
-       #./kill.cmd.sh `cat $HOME/monitor/SKIP`
-       exit
-else
-       echo $$ > $HOME/monitor/SKIP
+       if [ -z "$1" ] ; then 
+               echo "KILLING Monitor"
+               ./kill.cmd.sh `cat $HOME/monitor/SKIP`
+               rm -f $HOME/monitor/SKIP
+       else 
+               # skipping monitor
+               echo "SKIPPING Monitor"
+               exit
+       fi 
 fi
+echo $$ > $HOME/monitor/SKIP
 #########################
 # 1. FINDBAD NODES 
 rm -f pdb/production.findbad2.pkl
@@ -37,6 +42,10 @@ cp badcsv.txt /plc/data/var/www/html/monitor/
 # 2. FINDBAD PCUS
 rm -f pdb/production.findbadpcus2.pkl
 ./findbadpcu.py --increment --refresh --debug=0 --dbname=findbadpcus2 $DATE            
+
+# clean up stray 'locfg' processes that hang around inappropriately...
+ps ax | grep locfg | grep -v grep | awk '{print $1}' | xargs kill
+
 # convert pkl to php serialize format.
 cp pdb/production.findbadpcus2.pkl pdb/production.findbadpcus.pkl
 ./pkl2php.py -i findbadpcus2 -o findbadpcus