#!/bin/bash

# Bring up/down snmpd

SETSID=/usr/bin/setsid
if [ -z "$RC_CONF" ] ; then
	. /etc/sysconfig/rc.conf
	. /etc/sysconfig/network.conf
fi

if [ -z "$NET_FUNCS" ] ; then
	. /bin/network-functions
fi

PIDFILE="/var/run/subagent.pid"
SERVICE=trapagent

do_start ()
{
	if ! ServiceCheckRunning1 ; then
		return $?
	fi

	$SETSID /bin/subagent & 
#	sleep 5
#	ServiceCheckRunning2

	return $?
}


do_stop ()
{
	ServiceStop

	return $?
}

do_status ()
{
	ServiceStatus 
	
	return $?
}


case "$1" in
	start)
		do_start
		;;
	stop)
		do_stop
		;;
	status)
		do_status
		;;
	restart)
		$0 stop
		$0 start
		;;
	*)
		echo "Usage: $0 {start|stop|restart|status}"
		exit 1
esac

exit $?
