#!/bin/sh
#
# ipxripd	ipxripd is an implementation of Novell's RIP and SAP protocols.
#
# chkconfig: 345 11 89
# description: ipxripd is an implementation of Novell's RIP and SAP protocols.
# processname: ipxripd
# pidfile: /var/run/ipxripd.pid

# Do not load RH compatibility interface.
WITHOUT_RC_COMPAT=1

# Source function library.
. /etc/init.d/functions

IPX=no
IPXRIPD=/usr/sbin/ipxripd
[ -x "$IPXRIPD" ] || exit

# Get config.
. /etc/sysconfig/network

# Check that networking is up.
[ "$NETWORKING" = yes ] || exit

# Check basic IPX config
[ "$IPX" = yes ] || exit


PIDFILE=/var/run/ipxripd.pid
LOCKFILE=/var/lock/subsys/ipxripd
RETVAL=0

start()
{
	# start daemons, perhaps with the daemon function, for example:
	start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user root -- ipxripd

	RETVAL=$?
	#[ $RETVAL -eq 0 ] && touch "$LOCKFILE"
	return $RETVAL
}	

stop()
{
	# stop daemons, perhaps with the killproc function, for example:
	stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user root -- ipxripd

	RETVAL=$?
	#[ $RETVAL -eq 0 ] && rm -f "$LOCKFILE"
	return $RETVAL
}

restart()
{
	stop
	start
}

reload()
{
    restart
}

# See how we were called.
case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	reload)
		reload
		;;
	restart)
		restart
		;;
	condstop)
		if [ -e "$LOCKFILE" ]; then
			stop
		fi
		;;
	condrestart)
		if [ -e "$LOCKFILE" ]; then
			restart
		fi
		;;
	condreload)
		if [ -e "$LOCKFILE" ]; then
			reload
		fi
		;;
	status)
		status --pidfile "$PIDFILE" --expect-user root -- ipxripd
		RETVAL=$?
		;;
	*)
		msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}"
		RETVAL=1
esac

exit $RETVAL
