Attempting no buffering rather than line buffering
authorBrian Flowers <git-admn@bsflowers.net>
Mon, 19 Sep 2016 17:09:06 +0000 (13:09 -0400)
committerBrian Flowers <git-admn@bsflowers.net>
Mon, 19 Sep 2016 17:09:06 +0000 (13:09 -0400)
bdsm.d/df.generic
bdsm.d/sensors.generic
bdsm.d/vmstat.generic
bdsm.sh

index 113560b..8e3b0a1 100755 (executable)
@@ -66,7 +66,7 @@ start()
     fi
 
     ssh -q $HOSTNAME <<EOF
-    nohup stdbuf -oL while [ 1 ]; do
+    nohup stdbuf -o0 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
index e344890..cc8a14a 100755 (executable)
@@ -62,7 +62,7 @@ start()
     fi
 
     ssh -q $HOSTNAME <<EOF
-    nohup stdbuf -oL while [ 1 ]; do
+    nohup stdbuf -o0 while [ 1 ]; do
       ts=`date '+%s'`
       sensors | \
       sed 's/  */ /g' | \
index 316e078..4afefe8 100755 (executable)
@@ -76,7 +76,7 @@ start()
     fi
 
     ssh -q $HOSTNAME <<EOF
-    nohup stdbuf -oL vmstat $vmopt $DELAY | awk $awkopt -v host=$HOSTNAME 'BEGIN {
+    nohup stdbuf -o0 vmstat $vmopt $DELAY | awk $awkopt -v host=$HOSTNAME 'BEGIN {
       OFS="|"
     }
     /us/ {
diff --git a/bdsm.sh b/bdsm.sh
index a923911..9ccaa6a 100755 (executable)
--- a/bdsm.sh
+++ b/bdsm.sh
@@ -179,7 +179,7 @@ start()
 
 
     j=0
-    echo $functions | tr ';' '\n' | sed 's/[(),]/ /g' | while read line; do
+    while read -U10 line; do
       command=`echo $line | cut -d' ' -f1`
       args="`echo $line | cut -d' ' -f2-`"
       if [ -f /home/bdsm/bdsm.d/$command.$type ]; then
@@ -189,7 +189,7 @@ start()
       else
         error "Could not find plugin for $command on $type:$host!"
       fi
-    done
+    done 10< <(echo $functions | tr ';' '\n' | sed 's/[(),]/ /g')
 
     i=`expr $i + 1`
   done