#!/bin/sh # # OneWire event monitor start/stop script. # # chkconfig: 345 99 1 # description: OneWire event monitor start/stop script. . /etc/rc.d/init.d/functions prog=/usr/local/oweventd/oweventd conf=/etc/sysconfig/oweventd [ -f $conf ] || exit 0 CONFIGS=`/bin/cat $conf` case "$1" in start) if [ ! -f /var/lock/subsys/oweventd ]; then echo -n "Starting OneWire event monitor: " daemon $prog $CONFIGS # daemon -10 --user monitor "/usr/lib/atmm/tester/TestNode.sh &" echo touch /var/lock/subsys/oweventd fi ;; stop) if [ -f /var/lock/subsys/oweventd ]; then echo -n "Shutting down OneWire event monitor: " PIDS=`/bin/ps ax | /bin/grep $prog | /bin/grep -v grep | /bin/awk '{print $1}'` if [ "$PIDS" != "" ]; then kill $PIDS RETVAL=$? [ $RETVAL = 0 ] && echo_success || echo_failure fi echo fi rm -f /var/lock/subsys/oweventd ;; restart) $0 stop $0 start ;; condrestart) [ -f /var/lock/subsys/oweventd ] || exit 0 $0 stop $0 start ;; status) status oweventd ;; *) echo "Usage: $0 {start|stop|restart|condrestart|status}" exit 1 esac exit 0