#!/bin/sh
#
# Copyright 2003 Meru Networks
# All rights reserved.
#
PROC=/opt/meru/bin/sipfd
HPROC=/etc/init.d/hsipfd

START_DELAY=.2

MNAME=`basename $PROC`
PIDFILE=/opt/wlan/var/run/${MNAME}.pid
LOG=/opt/wlan/var/log/${MNAME}.log

if [ -f /etc/init.d/meru-functions ]; then
	. /etc/init.d/meru-functions
else
	echo "/etc/init.d/meru-functions must exist to use $0"; exit 1
fi

start() {

    monit_start_multi_threads_without_writepid
}

stop() {

    monit_stop_process
}

case "$1" in
	start)
		if [ -x $HPROC ]; then
			$HPROC start
		else
			if vrfy monit; then
				start_with_monit $MNAME
			else
				start
			fi
		fi
		;;
	stop)
		if [ -x $HPROC ]; then
			$HPROC stop
		else
			if vrfy monit; then
                                stop_with_monit $MNAME
			else
				stop
			fi
		fi
		;;
	restart)
		if [ -x $HPROC ]; then
			$HPROC restart
		else
			if vrfy monit; then
                                restart_with_monit $MNAME
			else
				stop
				start
			fi
		fi
		;;
	mstart)
		start
		;;
	mstop)
		stop
		;;
	*)
		echo $"Usage: $prog {start|stop|restart}"
		exit 1
esac

exit 0
