]>
Commit | Line | Data |
---|---|---|
bdeb1016 | 1 | #!/bin/sh |
2 | # DHCP Server | |
3 | # | |
c01c2dc3 | 4 | # chkconfig: 345 80 20 |
5 | # description: DHCP Server | |
bdeb1016 | 6 | |
c01c2dc3 | 7 | # Source function library |
bdeb1016 | 8 | . /etc/rc.d/init.d/functions |
9 | ||
c01c2dc3 | 10 | # Get network config |
11 | . /etc/sysconfig/network | |
12 | ||
13 | # Get service config | |
14 | [ -f /etc/sysconfig/dhcp ] && . /etc/sysconfig/dhcp | |
15 | ||
16 | # Check that networking is up. | |
17 | [ "${NETWORKING}" = "no" ] && echo "Error: Networking is down" && exit 0 | |
18 | ||
bdeb1016 | 19 | |
20 | # See how we were called. | |
21 | case "$1" in | |
22 | start) | |
c01c2dc3 | 23 | # Check if the service is already running? |
24 | if [ ! -f /var/lock/subsys/dhcpd ]; then | |
25 | show Starting dhcpd | |
26 | daemon dhcpd | |
27 | else | |
28 | echo "dhcpd already is running" | |
29 | fi | |
30 | touch /var/lock/subsys/dhcpd | |
bdeb1016 | 31 | show Starting DHCP Server |
32 | daemon dhcpd | |
33 | touch /var/lock/subsys/dhcpd | |
34 | ;; | |
35 | stop) | |
36 | show Stopping DHCP Server | |
37 | killproc dhcpd | |
38 | rm -f /var/run/dhcpd.pid | |
39 | rm -f /var/lock/subsys/dhcpd | |
40 | ;; | |
c01c2dc3 | 41 | restart|reload) |
bdeb1016 | 42 | $0 stop |
43 | $0 start | |
44 | ;; | |
45 | status) | |
46 | status dhcpd | |
47 | ;; | |
48 | *) | |
c01c2dc3 | 49 | echo "Usage: $0 {start|stop|restart|reload|status}" |
bdeb1016 | 50 | exit 1 |
51 | esac | |
52 | ||
53 | exit 0 | |
54 |