]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | # | |
3 | # dhcp6c dhcp6c is an implementation of DHCPv6 server. | |
4 | # This shell script takes care of starting and stopping | |
5 | # dhcp6c. | |
6 | # | |
7 | # chkconfig: 345 66 36 | |
8 | # description: dhcp6c supports server side of Dynamic Host Configuration Protocol for IPv6. | |
9 | # processname: dhcp6c | |
10 | # config: /etc/dhcp6c.conf | |
11 | # config: /etc/sysconfig/dhcp6c | |
12 | # | |
13 | # $Id$ | |
14 | ||
15 | # Source function library | |
16 | . /etc/rc.d/init.d/functions | |
17 | ||
18 | # Get network config | |
19 | . /etc/sysconfig/network | |
20 | ||
21 | # Get service config | |
22 | [ -f /etc/sysconfig/dhcp6c ] && . /etc/sysconfig/dhcp6c | |
23 | ||
24 | # Check that networking is up. | |
25 | if is_yes "${NETWORKING}"; then | |
26 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then | |
27 | msg_network_down "DHCPv6 client daemon" | |
28 | exit 1 | |
29 | fi | |
30 | else | |
31 | exit 0 | |
32 | fi | |
33 | ||
34 | start() { | |
35 | # Check if the service is already running? | |
36 | if [ ! -f /var/lock/subsys/dhcp6c ]; then | |
37 | msg_starting "DHCPv6 client daemon" | |
38 | daemon dhcp6c $DHCP6CIF | |
39 | RETVAL=$? | |
40 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcp6c | |
41 | else | |
42 | msg_already_running "DHCPv6 client daemon" | |
43 | fi | |
44 | } | |
45 | ||
46 | stop() { | |
47 | if [ -f /var/lock/subsys/dhcp6c ]; then | |
48 | msg_stopping "DHCPv6 client daemon" | |
49 | killproc dhcp6c | |
50 | rm -f /var/run/dhcp6c.pid /var/lock/subsys/dhcp6c >/dev/null 2>&1 | |
51 | else | |
52 | msg_not_running "DHCPv6 client daemon" | |
53 | fi | |
54 | } | |
55 | ||
56 | condrestart() { | |
57 | if [ -f /var/lock/subsys/dhcp6c ]; then | |
58 | stop | |
59 | start | |
60 | else | |
61 | msg_not_running "DHCPv6 client daemon" | |
62 | RETVAL=$1 | |
63 | fi | |
64 | } | |
65 | ||
66 | RETVAL=0 | |
67 | case "$1" in | |
68 | start) | |
69 | start | |
70 | ;; | |
71 | stop) | |
72 | stop | |
73 | ;; | |
74 | restart) | |
75 | stop | |
76 | start | |
77 | ;; | |
78 | try-restart) | |
79 | condrestart 0 | |
80 | ;; | |
81 | force-reload) | |
82 | condrestart 7 | |
83 | ;; | |
84 | status) | |
85 | status dhcp6c | |
86 | exit $? | |
87 | ;; | |
88 | *) | |
89 | msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}" | |
90 | exit 3 | |
91 | esac | |
92 | ||
93 | exit $RETVAL |