#!/bin/sh
#
# Copyright 2007 Meru Networks
# All rights reserved.
#

#
#Global variables
#

PROC=/opt/meru/bin/oct_watchdog
KDIR=/opt/meru/kernel

START_DELAY=.2

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

#
#Verify meru-functions is present; include it
#

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

. /etc/init.d/meru-functions

#
#Make sure that oct-ctrl is present
#

OCT_CTRL=/opt/meru/bin/oct/oct-ctrl

if [ ! -f $OCT_CTRL ]; then
	echo "${OCT_CTRL} must exist to use $0" >> $LOG; exit 1
fi

#
#Should not run the oct_watchdog script if there are no Octeon cards
#

NUM_OCT=`${OCT_CTRL} count`

if [ $NUM_OCT -eq 0 ]; then
	echo "This platform does not support $0" >> $LOG; exit 2
fi

#
#Verify the actual oct_watchdog binary is present
#

if [ ! -f $PROC ]; then
	echo "${PROC} must exist to use $0" >> $LOG; exit 3
fi

#
#Functions
#
monit_control_multi_threads $1

exit 0
