]>
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 | # | |
275815ab ER |
7 | # chkconfig: 345 66 36 |
8 | # description: dhcp6c supports server side of Dynamic Host Configuration Protocol for IPv6. | |
05357254 | 9 | # processname: dhcp6c |
10 | # config: /etc/dhcp6c.conf | |
11 | # config: /etc/sysconfig/dhcp6c | |
275815ab ER |
12 | # |
13 | # $Id$ | |
982871cc | 14 | |
05357254 | 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 | |
e39b0a43 | 26 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then |
982871cc | 27 | msg_network_down "DHCPv6 client daemon" |
e39b0a43 ER |
28 | exit 1 |
29 | fi | |
30 | else | |
31 | exit 0 | |
05357254 | 32 | fi |
33 | ||
833a3882 | 34 | start() { |
e39b0a43 ER |
35 | # Check if the service is already running? |
36 | if [ ! -f /var/lock/subsys/dhcp6c ]; then | |
982871cc | 37 | msg_starting "DHCPv6 client daemon" |
e39b0a43 ER |
38 | daemon dhcp6c $DHCP6CIF |
39 | RETVAL=$? | |
40 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcp6c | |
41 | else | |
982871cc | 42 | msg_already_running "DHCPv6 client daemon" |
e39b0a43 | 43 | fi |
833a3882 ER |
44 | } |
45 | ||
46 | stop() { | |
e39b0a43 | 47 | if [ -f /var/lock/subsys/dhcp6c ]; then |
982871cc | 48 | msg_stopping "DHCPv6 client daemon" |
e39b0a43 ER |
49 | killproc dhcp6c |
50 | rm -f /var/run/dhcp6c.pid /var/lock/subsys/dhcp6c >/dev/null 2>&1 | |
51 | else | |
982871cc | 52 | msg_not_running "DHCPv6 client daemon" |
e39b0a43 | 53 | fi |
833a3882 ER |
54 | } |
55 | ||
89af4c3c JB |
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 | ||
833a3882 ER |
66 | RETVAL=0 |
67 | case "$1" in | |
68 | start) | |
69 | start | |
70 | ;; | |
71 | stop) | |
72 | stop | |
e39b0a43 | 73 | ;; |
89af4c3c | 74 | restart) |
833a3882 ER |
75 | stop |
76 | start | |
e39b0a43 | 77 | ;; |
89af4c3c JB |
78 | try-restart) |
79 | condrestart 0 | |
80 | ;; | |
81 | force-reload) | |
82 | condrestart 7 | |
83 | ;; | |
05357254 | 84 | status) |
e39b0a43 ER |
85 | status dhcp6c |
86 | exit $? | |
87 | ;; | |
05357254 | 88 | *) |
89af4c3c | 89 | msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}" |
e39b0a43 | 90 | exit 3 |
05357254 | 91 | esac |
2cba2f07 | 92 | |
05357254 | 93 | exit $RETVAL |