#!/bin/sh

. /bin/network-functions

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

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

	/etc/init.d/softdogd wait
	$SETSID /bin/redundancy_swapper > /dev/null 2>&1 &

	ServiceCheckRunning2

	return
}

do_stop ()
{
	/etc/init.d/softdogd wait

	ServiceStop;

	return $?
}

do_status ()
{
	ServiceStatus

	return $?
}

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

exit $?
