]> git.pld-linux.org Git - packages/dhcp.git/blob - dhcp6.init
- patch no-ipv6 - don't require ipv6 support in kernel
[packages/dhcp.git] / dhcp6.init
1 #!/bin/sh
2 # DHCP IPv6 Server
3 #
4 # chkconfig:    345 80 20
5 # description:  DHCP IPv6 Server
6
7 # Source function library
8 . /etc/rc.d/init.d/functions
9
10 # Get network config
11 . /etc/sysconfig/network
12
13 # Get service config
14 [ -f /etc/sysconfig/dhcpd ] && . /etc/sysconfig/dhcpd
15
16 # Check that networking is up.
17 if is_yes "${NETWORKING}"; then
18         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
19                 msg_network_down "DHCP IPv6 Server"
20                 exit 1
21         fi
22 else
23         exit 0
24 fi
25
26 checkconfig() {
27         show "Checking %s configuration" "DHCP IPv6 Server"
28         out=`/sbin/dhcpd -t 2>&1`; rc=$?
29         if [ $rc -gt 0 ]; then
30                 fail
31                 echo >&2 "$out"
32         else
33                 ok
34         fi
35         return $rc
36 }
37
38 start() {
39         # Check if the service is already running?
40         if [ ! -f /var/lock/subsys/dhcpd6 ]; then
41                 msg_starting "DHCP IPv6 Server"
42                 daemon /sbin/dhcpd -6 $DHCPD_INTERFACES
43                 RETVAL=$?
44                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcpd6
45         else
46                 msg_already_running "DHCP IPv6 Server"
47         fi
48 }
49
50 stop() {
51         if [ -f /var/lock/subsys/dhcpd6 ]; then
52                 msg_stopping "DHCP IPv6 Server"
53                 killproc dhcpd
54                 rm -f /var/run/dhcpd.pid /var/lock/subsys/dhcpd6 >/dev/null 2>&1
55         else
56                 msg_not_running "DHCP IPv6 Server"
57         fi
58 }
59
60 condrestart() {
61         if [ -f /var/lock/subsys/dhcpd6 ]; then
62                 stop
63                 start
64         else
65                 msg_not_running dhcpd
66                 RETVAL=$1
67         fi
68 }
69
70 RETVAL=0
71 # See how we were called.
72 case "$1" in
73   start)
74         checkconfig || exit 1
75         start
76         ;;
77   stop)
78         stop
79         ;;
80   restart)
81         checkconfig || exit 1
82         stop
83         start
84         ;;
85   try-restart)
86         checkconfig || exit 1
87         condrestart 0
88         ;;
89   force-reload)
90         checkconfig || exit 1
91         condrestart 7
92         ;;
93   checkconfig)
94         checkconfig
95         ;;
96   status)
97         status dhcpd
98         exit $?
99         ;;
100   *)
101         msg_usage "$0 {start|stop|restart|try-restart|force-reload|checkconfig|status}"
102         exit 3
103 esac
104
105 exit $RETVAL
This page took 0.054503 seconds and 3 git commands to generate.