Adding -n to compatibility ssh to block standard input
authorBrian Flowers <git-admn@bsflowers.net>
Mon, 19 Sep 2016 00:43:22 +0000 (20:43 -0400)
committerBrian Flowers <git-admn@bsflowers.net>
Mon, 19 Sep 2016 00:43:22 +0000 (20:43 -0400)
bdsm.d/df.generic
bdsm.d/sensors.generic
bdsm.d/vmstat.generic
bdsm.sh

index a01a0c9..5ff6f59 100755 (executable)
@@ -106,7 +106,7 @@ status()
 
 compatible()
 {
-  compatible="`ssh -q $HOSTNAME 'df --output=pcent /' 2>&1 1>/dev/null`"
+  compatible="`ssh -q -n $HOSTNAME 'df --output=pcent /' 2>&1 1>/dev/null`"
   if [ "$compatible" != "" ]; then
     echo 0
     return
index b2059d1..24c82a4 100755 (executable)
@@ -118,7 +118,7 @@ status()
 
 compatible()
 {
-  compatible="`ssh -q $HOSTNAME 'sensors' 2>&1 1>/dev/null`"
+  compatible="`ssh -q -n $HOSTNAME 'sensors' 2>&1 1>/dev/null`"
   if [ "$compatible" != "" ]; then
     echo 0
     return
index f6f9f06..316e078 100755 (executable)
@@ -139,7 +139,7 @@ status()
 
 compatible()
 {
-  compatible="`ssh -q $HOSTNAME 'stdbuf -oL vmstat 5' 2>&1 1>/dev/null`"
+  compatible="`ssh -q -n $HOSTNAME 'stdbuf -oL vmstat' 2>&1 1>/dev/null`"
   if [ "$compatible" != "" ]; then
     echo 0
     return
diff --git a/bdsm.sh b/bdsm.sh
index 0a52faf..9933aad 100755 (executable)
--- a/bdsm.sh
+++ b/bdsm.sh
@@ -315,24 +315,23 @@ configure()
     header "Configuring $host"
     #availServices=$(ls /home/bdsm/bdsm.d | cut -d'.' -f1 | sort -u)
     availServices=()
-    find /home/bdsm/bdsm.d -executable -type f | \
-      sed 's|/home/bdsm/bdsm.d/||g' | \
-      cut -d'.' -f1 | \
-      sort -u | \
-      while read service; do
-        svc=`echo $service | sed 's/(.*)$//g'`
-        if [ -f /home/bdsm/bdsm.d/$svc.$type ]; then
-          serviceFile="$svc.$type"
-        elif [ -f /home/bdsm/bdsm.d/$svc.generic ]; then
-          serviceFile="$svc.generic"
+    while read service; do
+        if [ -f /home/bdsm/bdsm.d/$service.$type ]; then
+          serviceFile="$service.$type"
+        elif [ -f /home/bdsm/bdsm.d/$service.generic ]; then
+          serviceFile="$service.generic"
         else
           error "$service plugin not found!"
         fi
         
-        if [ "`/home/bdsm/bdsm.d/$serviceFile compatible $host`" -eq "1" ]; then
+        compatible=($(/home/bdsm/bdsm.d/$serviceFile compatible $host))
+        if [ "$compatible" -eq "1" ]; then
             availServices+=($service)
         fi
-    done
+    done <($(find /home/bdsm/bdsm.d -executable -type f | \
+      sed 's|/home/bdsm/bdsm.d/||g' | \
+      cut -d'.' -f1 | \
+      sort -u))
     
     services=$(cat /home/bdsm/.bdsm.conf.tmp | grep ":$host{" | \
       sed 's/.*{\(.*\)}/\1/g' | tr ';' ' ')