info "Starting $type monitors on $host..."
functions=`cat $config_path/.bdsm.conf.tmp | grep "$type:$host" | sed 's/.*{\(.*\)}.*/\1/'`
- ssh -q $host "cat /home/bdsm/out.fifo" > /home/bdsm/in.fifo &
+ ssh -q $host "stdbuf -oL cat /home/bdsm/out.fifo" > /home/bdsm/in.fifo &
echo $! > /home/bdsm/pids/$host.in
args="`echo $line | cut -d' ' -f2-`"
if [ -f $config_path/monitors/$command.$type ]; then
$config_path/monitors/$command.$type start $host $args
- elif [ -f $config_path/monitors/$command.$type ]; then
+ elif [ -f $config_path/monitors/$command.generic ]; then
$config_path/monitors/$command.generic start $host $args
else
error "Could not find plugin for $command on $type:$host!"
args="`echo $line | cut -d' ' -f2-`"
if [ -f $config_path/monitors/$command.$type ]; then
$config_path/monitors/$command.$type stop $host $args
- elif [ -f $config_path/monitors/$command.$type ]; then
+ elif [ -f $config_path/monitors/$command.generic ]; then
$config_path/monitors/$command.generic stop $host $args
else
error "Could not find plugin for $command on $type:$host!"
prefix="$type:$host|$command|"
if [ -f $config_path/monitors/$command.$type ]; then
$config_path/monitors/$command.$type status $host | sed "s/^/$prefix/g"
- elif [ -f $config_path/monitors/$command.$type ]; then
+ elif [ -f $config_path/monitors/$command.generic ]; then
$config_path/monitors/$command.generic status $host | sed "s/^/$prefix/g"
else
error "Could not find plugin for $command on $type:$host!"
i=`expr $i + 1`
done
- mkfifo /home/bdsm/in.fifo
- mkdir /home/bdsm/pids
+ mkfifo /home/bdsm/in.fifo 2>/dev/null
+ mkdir /home/bdsm/pids 2>/dev/null
}
# SCRIPT START
SCRIPT=$0
HOSTNAME=$2
DELAY=$3
-SENSOR-ID="${4}"
OUTPATH=/home/bdsm/out.fifo
# MAIN FUNCTIONS
echo "FUNCTION -- start/stop/status/help"
echo "HOSTNAME -- the hostname to monitor"
echo "::DELAY -- seconds between measurements"
- echo "::SENSOR-ID -- the serial number of the sensor to read"
exit 0
}
{
compatible="`ssh -q -n $HOSTNAME 'cat /sys/bus/w1/devices/w1_bus_master1/w1_master_slaves | grep \"^28\" | wc -l' 2>/dev/null`"
if [ "$compatible" -gt 0 ]; then
- echo 0
- else
echo 1
+ else
+ echo 0
fi
}