#!/bin/bash # $Id: mnwclient.init,v 1.9 2002/01/13 17:22:03 wagnerch Exp $ # # mnwclient This shell script takes care of starting and stopping # myNetWatchman Perl Agent. # # chkconfig: 2345 86 12 # description: mnwclient PATH=/usr/bin:/sbin:/bin:/usr/sbin export PATH # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 # check if the mnwclient.rc file is present [ -f /etc/mnwclient.rc ] || exit 0 # check to see if mnwclient exists [ -f /usr/sbin/mnwclient ] || exit 0 case "$1" in start) echo -n "Starting myNetWatchman Agent: " pidlist=`pidofproc mnwclient` pid= for apid in $pidlist ; do [ -d /proc/$apid ] && pid="$pid $apid" done [ -n "$pid" ] && ps h $pid >/dev/null 2>&1 && exit 0 /usr/sbin/mnwclient & RETVAL=$? if [ $RETVAL -eq 0 ]; then echo $! >/var/run/mnwclient.pid success "mnwclient startup" echo touch /var/lock/subsys/mnwclient else echo_failure fi ;; stop) echo -n "Stopping myNetWatchman Agent: " killproc mnwclient RETVAL=$? if [ $RETVAL -eq 0 ] ; then rm -f /var/lock/subsys/mnwclient echo else echo fi ;; restart) $0 stop $0 start ;; status) status mnwclient ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit $RETVAL