1#! /bin/sh
2#
3# $Id: radvd.init,v 1.6 2009/05/25 06:17:28 psavola Exp $
4#
5### BEGIN INIT INFO
6# provides: radvd
7# chkconfig: - 54 46
8# short-Description: router advertisement daemon for IPv6
9# description:	radvd is the router advertisement daemon for IPv6.  It \
10#		listens to router solicitations and sends router \
11#		advertisements as described in "Neighbor Discovery for IP \
12#		Version 6 (IPv6)" (RFC 2461).  With these advertisements \
13#		hosts can automatically configure their addresses and some \
14#		other parameters.  They also can choose a default router \
15#		based on these advertisements.
16#
17# processname: radvd
18# pidfile: /var/run/radvd.pid
19# config: /etc/radvd.conf
20# config: /etc/sysconfig/radvd
21### END INIT INFO
22
23# Source function library.
24. /etc/rc.d/init.d/functions
25
26# Get config.
27. /etc/sysconfig/network
28
29[ -f /etc/sysconfig/radvd ] && . /etc/sysconfig/radvd
30
31RETVAL=0
32PROG="radvd"
33LOCKFILE=/var/lock/subsys/radvd
34
35# See how we were called.
36case "$1" in
37  start)
38	if [ ! -f /etc/radvd.conf ]; then
39		echo $"Configuration file /etc/radvd.conf missing" 1>&2
40		exit 6
41	fi
42	if [ `id -u` -ne 0 ]; then
43		echo $"Insufficient privilege" 1>&2
44		exit 4
45	fi
46	echo -n $"Starting $PROG: "
47	daemon radvd $OPTIONS
48	RETVAL=$?
49	echo
50	[ $RETVAL -eq 0 ] && touch $LOCKFILE
51	;;
52  stop)
53	echo -n $"Stopping $PROG: "
54	killproc radvd
55	RETVAL=$?
56	echo
57	[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
58	;;
59  status)
60	status radvd
61	RETVAL=$?
62	;;
63  restart)
64	$0 stop
65	$0 start
66	RETVAL=$?
67	;;
68  reload)
69	echo -n $"Reloading $PROG: "
70	killproc radvd -HUP
71	RETVAL=$?	
72	echo
73	;;
74  condrestart)
75        if [ -f $LOCKFILE ]; then
76		$0 stop
77		$0 start
78		RETVAL=$?
79	fi
80        ;;  
81  *)
82	echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
83	exit 2
84esac
85
86exit $RETVAL
87