From e3c0b8d75da0afc973dbe7c7addca5a465e1763d Mon Sep 17 00:00:00 2001 From: Brian Flowers Date: Sun, 18 Sep 2016 20:43:22 -0400 Subject: [PATCH] Adding -n to compatibility ssh to block standard input --- bdsm.d/df.generic | 2 +- bdsm.d/sensors.generic | 2 +- bdsm.d/vmstat.generic | 2 +- bdsm.sh | 23 +++++++++++------------ 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/bdsm.d/df.generic b/bdsm.d/df.generic index a01a0c9..5ff6f59 100755 --- a/bdsm.d/df.generic +++ b/bdsm.d/df.generic @@ -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 diff --git a/bdsm.d/sensors.generic b/bdsm.d/sensors.generic index b2059d1..24c82a4 100755 --- a/bdsm.d/sensors.generic +++ b/bdsm.d/sensors.generic @@ -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 diff --git a/bdsm.d/vmstat.generic b/bdsm.d/vmstat.generic index f6f9f06..316e078 100755 --- a/bdsm.d/vmstat.generic +++ b/bdsm.d/vmstat.generic @@ -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 --- 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 ';' ' ') -- 1.8.3.1