additional bugfixes for last few commits
authorBrian Flowers <git-admn@bsflowers.net>
Mon, 19 Sep 2016 18:06:36 +0000 (14:06 -0400)
committerBrian Flowers <git-admn@bsflowers.net>
Mon, 19 Sep 2016 18:06:36 +0000 (14:06 -0400)
bdsm.d/df.generic
bdsm.d/sensors.generic
bdsm.sh

index edcdea5..5c628fd 100755 (executable)
@@ -66,10 +66,10 @@ start()
     fi
 
     ssh -q $HOSTNAME <<EOF
-    nohup stdbuf -o0 while [ 1 ]; do
+    while [ 1 ]; do
       df=`df --output=pcent "$DRIVE" | tail -1 | sed 's/[^0-9]//g'`
       ts=`date '+%s'`
-      echo "$ts|$HOSTNAME|DISK-$LABEL-USED|$df" >> $OUTPATH
+      nohup stdbuf -o0 echo "\$ts|$HOSTNAME|DISK-$LABEL-USED|\$df" >> $OUTPATH
       sleep $DELAY
     done &
 EOF
index f9290d0..3be2098 100755 (executable)
@@ -62,12 +62,12 @@ start()
     fi
 
     ssh -q $HOSTNAME <<EOF
-    nohup stdbuf -o0 while [ 1 ]; do
+    while [ 1 ]; do
       ts=`date '+%s'`
-      sensors | \
+      nohup stdbuf -o0 sensors | \
       sed 's/  */ /g' | \
       sed 's/[(].*[)]//g' \
-      | awk -v ts=$ts -v host=$HOSTNAME 'BEGIN {
+      | awk -v ts=\$ts -v host=\$HOSTNAME 'BEGIN {
         line=1
     } {
       if($0 == "") {
diff --git a/bdsm.sh b/bdsm.sh
index 6e3c637..1b01296 100755 (executable)
--- a/bdsm.sh
+++ b/bdsm.sh
@@ -174,13 +174,16 @@ start()
     info "Starting $type monitors on $host..."
     functions=`cat /home/bdsm/.bdsm.conf.tmp | grep "$type:$host" | sed 's/.*{\(.*\)}.*/\1/'`
         
-    ssh $host "cat /home/bdsm/out.fifo" > /home/bdsm/in.fifo &
+    ssh -q $host "cat /home/bdsm/out.fifo" > /home/bdsm/in.fifo &
     echo $! > /home/bdsm/pids/$host.in
 
 
     j=0
     while read -u10 line; do
       command=`echo $line | cut -d' ' -f1`
+      if [ "$command" == "" ]; then
+        continue
+      fi
       args="`echo $line | cut -d' ' -f2-`"
       if [ -f /home/bdsm/bdsm.d/$command.$type ]; then
         /home/bdsm/bdsm.d/$command.$type start $host $args
@@ -207,6 +210,9 @@ stop()
     j=0
     echo $functions | tr ';' '\n' | sed 's/[(),]/ /g' | while read line; do
       command=`echo $line | cut -d' ' -f1`
+      if [ "$command" == "" ]; then
+        continue
+      fi
       args="`echo $line | cut -d' ' -f2-`"
       if [ -f /home/bdsm/bdsm.d/$command.$type ]; then
         /home/bdsm/bdsm.d/$command.$type stop $host $args