From: Brian Flowers Date: Wed, 12 Oct 2016 16:19:18 +0000 (-0400) Subject: Added TODO; fixed some bugs in process termination X-Git-Url: http://git.slightlycyberpunk.com%2C%20git.slightlycyberpunk.com/git/?a=commitdiff_plain;h=dd85bed0240cec96df67e8a9d4fccc4cd8b2d20b;p=bdsm.git Added TODO; fixed some bugs in process termination --- diff --git a/TODO b/TODO new file mode 100644 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 diff --git a/bdsm.d/df.generic b/bdsm.d/df.generic index 241ef5d..93f9790 100755 --- a/bdsm.d/df.generic +++ b/bdsm.d/df.generic @@ -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() diff --git a/bdsm.d/vmstat.generic b/bdsm.d/vmstat.generic index d3b37c3..2779ae7 100755 --- a/bdsm.d/vmstat.generic +++ b/bdsm.d/vmstat.generic @@ -75,7 +75,7 @@ start() awkopt="-W interactive" fi - ssh -q $HOSTNAME </dev/null <> $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 --- 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`