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