#!/bin/sh

PROCESS="sensorsd"

#Do not modify below this line#
###################################

if [ "$1" = "test" ]; then
    exec >> /var/log/watchdog/test-bin.stdout
    PID=`cat /var/run/$PROCESS/$PROCESS.pid`

    kill -s 0 $PID
    if [ "$?" = "0" ]; then 
        exit 0  #process is running
    else
        /bin/echo -n "$PROCESS - "
        date
        exit 1  #process not running
    fi
elif [ "$1" = "repair" ]; then
    exec >> /var/log/watchdog/repair-bin.stdout
    echo " "
    date
    /etc/init.d/$PROCESS restart
    exit 0
else
    echo "Unknown Parameter"
    exit 0
fi
