#!/bin/sh
#
# ipxripd	IPX RIP/SAP routing daemon
#
# chkconfig:	345 35 89
#
# description:	ipxripd is an implementation of Novell's RIP and SAP protocols. \
#		It automagically builds and updates IPX routing table \
#		in the Linux kernel. \
#		Usefull when trying to get a Linux box to act as an IPX router.

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

# Get network config
. /etc/sysconfig/network

# Get service config
[ -f /etc/sysconfig/ipxripd ] && . /etc/sysconfig/ipxripd

# Check that networking is up.
if is_yes "${NETWORKING}"; then
	if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
		msg_network_down ipxripd
		exit 1
	fi
else
	exit 0
fi

RETVAL=0
# See how we were called.
case "$1" in
  start)
	# Check if the service is already running?
	if [ ! -f /var/lock/subsys/ipxripd ]; then
		msg_starting ipxripd
		OPTIONS=""
		[ "$PASSIVE" = "yes" ] && OPTIONS="-p"
		[ -n "$LOGFILE" ] && OPTIONS="$OPTIONS -l $LOGFILE"
		[ -n "$TICKSFILE" ] && OPTIONS="$OPTIONS -t $TICKSFILE"
		daemon ipxd $OPTIONS
		RETVAL=$?
		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ipxripd
	else
		msg_already_running ipxripd
	fi
	;;
  stop)
	# Check if the service is already running?
	if [ -f /var/lock/subsys/ipxripd ]; then
		msg_stopping ipxripd
		killproc ipxd
		rm -f /var/lock/subsys/ipxripd
	else
		msg_not_running ipxripd
	fi
	;;
  restart|force-reload)
	$0 stop
	$0 start
	exit $?
	;;
  status)
	status ipxd
	exit $?
	;;
  *)
	msg_usage "$0 {start|stop|restart|force-reload|status}"
	exit 3
esac

exit $RETVAL
