#! /bin/sh
#
### BEGIN INIT INFO
# Provides: radvd
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: router advertisement daemon for IPv6
### END INIT INFO

. /etc/rc.status

# Shell functions sourced from /etc/rc.status:
#      rc_check         check and set local and overall rc status
#      rc_status        check and set local and overall rc status
#      rc_status -v     ditto but be verbose in local rc status
#      rc_status -v -r  ditto and clear the local rc status
#      rc_failed        set local and overall rc status to failed
#      rc_reset         clear local rc status (overall remains)
#      rc_exit          exit appropriate to overall rc status

# First reset status of this service
rc_reset

[ -f /etc/sysconfig/radvd ] && . /etc/sysconfig/radvd

if [ "$1" == "status" ]; then
	[ -f /usr/sbin/radvd ] || exit 4
else 
	[ -f /usr/sbin/radvd ] || exit 1
fi

RETVAL=0
PROG="radvd"
RADVD_BIN="/usr/sbin/radvd"

# See how we were called.
case "$1" in
  start)

	echo -n "Starting $PROG: "
	startproc -f -p /var/run/radvd/radvd.pid $RADVD_BIN $OPTIONS
	rc_status -v
	;;
  stop)
	echo -n "Stopping $PROG: "
	killproc -p /var/run/radvd/radvd.pid $RADVD_BIN
	rc_status -v
	;;
  status)
	checkproc -p /var/run/radvd/radvd.pid $RADVD_BIN
	rc_status -v
	;;
  restart)
	$0 stop
	$0 start
	;;
  reload)
	echo -n $"Reloading $PROG: "
	killproc -p /var/run/radvd/radvd.pid -HUP $RADVD_BIN
	rc_status -v
	;;
  *)
	echo $"Usage: $0 {start|stop|status|restart|reload}"
	exit 1
esac

rc_exit
