From: Brian Flowers Date: Mon, 19 Sep 2016 17:13:36 +0000 (-0400) Subject: Fixing broken status loop X-Git-Url: http://git.slightlycyberpunk.com%2C%20git.slightlycyberpunk.com/git/?a=commitdiff_plain;h=7a803cc9bf6c13aa8acefbe1b65c51512856b77e;p=bdsm.git Fixing broken status loop --- diff --git a/bdsm.sh b/bdsm.sh index 9ccaa6a..82d2f6f 100755 --- a/bdsm.sh +++ b/bdsm.sh @@ -234,7 +234,7 @@ status() functions=`cat /home/bdsm/.bdsm.conf.tmp | grep "$type:$host" | sed 's/.*{\(.*\)}.*/\1/'` j=0 - echo $functions | tr ';' '\n' | sed 's/[(),]/ /g' | while read line; do + while read -u10 line; do command=`echo $line | cut -d' ' -f1` prefix="$type:$host|$command|" if [ -f /home/bdsm/bdsm.d/$command.$type ]; then @@ -244,9 +244,9 @@ status() else error "Could not find plugin for $command on $type:$host!" fi - done + done 10< <(echo $functions | tr ';' '\n' | sed 's/[(),]/ /g') - pid=`cat /home/bdsm/pids/$host.in` + pid=`cat /home/bdsm/pids/$host.in 2>/dev/null` if [ ! -f /home/bdsm/pids/$host.in ]; then echo "$type:$host:MONITOR|???" elif [ `ps -p $pid | wc -l` -ge 2 ]; then