#!/bin/sh

# dont go to the main loop if another instance
# of watchdog.sh is running

# simple basename replacement
myfilename=`echo $0|sed 's#^.*/##'`

# are there other watchdogs running?
# the command pidof then returns a list of pids 
# seperated with space. If there is a space in the
# output there are other instances
pidof $myfilename |grep " "
[ $? != 0 ] || exit 1

echo "Starting watchdog..."
while(true)
do
echo \0 > /dev/watchdog
sleep 10
done
