Added TODO; fixed some bugs in process termination
authorBrian Flowers <git-admn@bsflowers.net>
Wed, 12 Oct 2016 16:19:18 +0000 (12:19 -0400)
committerBrian Flowers <git-admn@bsflowers.net>
Wed, 12 Oct 2016 16:19:18 +0000 (12:19 -0400)
TODO [new file with mode: 0644]
bdsm.d/df.generic
bdsm.d/vmstat.generic
bdsm.sh

diff --git a/TODO b/TODO
new file mode 100644 (file)
index 0000000..dd59d54
--- /dev/null
+++ b/TODO
@@ -0,0 +1,26 @@
+TODO
+
+BUGFIXES:
+ - Fix sqlite3 logging -- needs to be globally writable
+    May require folder structure refactoring
+
+
+PLUGINS:
+ - Starting vmstat on monitor (but not www) echos SSH banner
+ REFACTORING:
+  - Folder structure
+     bin/bdsm
+     etc/bdsm.d/monitors
+     etc/bdsm.d/processors
+     etc/bdsm.d/bdsm.db
+     etc/bdsm.d/bdsm.conf
+     etc/bdsm.d/out.fifo
+     etc/bdsm.d/in.fifo
+     etc/bdsm.d/pids
+     etc/bdsm.d/errors.log
+     etc/bdsm.d/bdsm.log
+ - Move all pids to pid folder
+ - Add a generic function for killing a process and deleting the pid file
+    Then add checking for 'orphaned' pids
+ - Replace some of the /dev/null redirects with error logging
\ No newline at end of file
index 241ef5d..93f9790 100755 (executable)
@@ -82,7 +82,7 @@ EOF
 stop()
 {
     ssh $HOSTNAME 'kill `cat /home/bdsm/.df.pid`'
-    ssh $HOSTNAME "rm /home/bdsm/.df.pid"
+    ssh $HOSTNAME 'rm /home/bdsm/.df.pid'
 }
 
 status()
index d3b37c3..2779ae7 100755 (executable)
@@ -75,7 +75,7 @@ start()
       awkopt="-W interactive"
     fi
 
-    ssh -q $HOSTNAME <<EOF
+    ssh -q $HOSTNAME 2>/dev/null <<EOF
     nohup stdbuf -oL vmstat $vmopt $DELAY | awk $awkopt -v host=$HOSTNAME 'BEGIN {
       OFS="|"
     }
@@ -106,7 +106,7 @@ start()
       close("date '+%s'")
     }' >> $OUTPATH 2>/home/bdsm/err.log &
 EOF
-    ssh -q $HOSTNAME "ps aux | \
+    ssh -q $HOSTNAME 2>/dev/null "ps aux | \
                   grep bdsm | \
                   grep vmstat | \
                   grep -v grep | \
@@ -119,8 +119,8 @@ EOF
 
 stop()
 {
-    ssh $HOSTNAME "kill `cat /home/bdsm/.vmstat.pid`"
-    ssh $HOSTNAME "rm /home/bdsm/.vmstat.pid"
+    ssh $HOSTNAME 'kill `cat /home/bdsm/.vmstat.pid`'
+    ssh $HOSTNAME 'rm /home/bdsm/.vmstat.pid'
 }
 
 status()
diff --git a/bdsm.sh b/bdsm.sh
index 12ed540..0592ee2 100755 (executable)
--- a/bdsm.sh
+++ b/bdsm.sh
@@ -239,6 +239,12 @@ stop()
       fi
     done
 
+    # These should terminate once all writing processes are killed
+    # Might need some error handling here -- this command SHOULD always fail
+    # If the processes exist, something is wrong!
+    kill `cat /home/bdsm/pids/$host.in` 2>/dev/null
+    rm /home/bdsm/pids/$host.in
+    
     /home/bdsm/bdsm.d/$processor.processor stop
 
     i=`expr $i + 1`