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
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