From efac74d61aa9201ce070f58f831cc539fe7c8369 Mon Sep 17 00:00:00 2001 From: Brian Flowers Date: Mon, 19 Sep 2016 13:18:56 -0400 Subject: [PATCH] Bugfixes for last few commits --- bdsm.d/df.generic | 3 +++ bdsm.d/sensors.generic | 3 +++ bdsm.d/vmstat.generic | 3 +++ bdsm.sh | 5 ++++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/bdsm.d/df.generic b/bdsm.d/df.generic index 90cbe35..edcdea5 100755 --- a/bdsm.d/df.generic +++ b/bdsm.d/df.generic @@ -97,6 +97,9 @@ status() grep -v PID | \ wc -l"` + if [ -z "$running" ]; then + running=0 + fi if [ $running -eq 0 ]; then echo "OFF" else diff --git a/bdsm.d/sensors.generic b/bdsm.d/sensors.generic index 9d74a79..f9290d0 100755 --- a/bdsm.d/sensors.generic +++ b/bdsm.d/sensors.generic @@ -109,6 +109,9 @@ status() grep -v PID | \ wc -l"` + if [ -z "$running" ]; then + running=0 + fi if [ $running -eq 0 ]; then echo "OFF" else diff --git a/bdsm.d/vmstat.generic b/bdsm.d/vmstat.generic index 7af1e58..a3b1fbe 100755 --- a/bdsm.d/vmstat.generic +++ b/bdsm.d/vmstat.generic @@ -130,6 +130,9 @@ status() grep -v PID | \ wc -l"` + if [ -z "$running" ]; then + running=0 + fi if [ $running -eq 0 ]; then echo "OFF" else diff --git a/bdsm.sh b/bdsm.sh index 82d2f6f..6e3c637 100755 --- a/bdsm.sh +++ b/bdsm.sh @@ -179,7 +179,7 @@ start() j=0 - while read -U10 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 @@ -236,6 +236,9 @@ status() j=0 while read -u10 line; do command=`echo $line | cut -d' ' -f1` + if [ "$command" == "" ]; then + continue + fi prefix="$type:$host|$command|" if [ -f /home/bdsm/bdsm.d/$command.$type ]; then /home/bdsm/bdsm.d/$command.$type status $host | sed "s/^/$prefix/g" -- 1.8.3.1