#!/bin/sh

# Start/Stop push notification sender daemon

. /bin/network-functions

SETSID=/usr/bin/setsid
PIDFILE=/var/run/fwhostcheck.pid
SERVICE=fwhostcheck
PROCESS_NAME=fw_fqdn

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

	/etc/init.d/softdogd wait
	$SETSID /bin/$PROCESS_NAME >/dev/null 2>/dev/null
	ServiceCheckRunning2
	return $?
}

do_stop ()
{
	local RESULT;

	/etc/init.d/softdogd wait
	ServiceStop
	RESULT=$?
	/bin/sleep 2
	return $RESULT
}

do_status ()
{
	local PNSENDERSTATUS;

	ServiceStatus
	PNSENDERSTATUS=$?
	return $PNSENDERSTATUS
}

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

exit $?
