Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # $Id: dhcp3-server.init.d,v 1.4 2003/07/13 19:12:41 mdz Exp $ |
| 4 | # |
| 5 | |
| 6 | test -f /usr/sbin/dhcpd || exit 0 |
| 7 | |
| 8 | # It is not safe to start if we don't have a default configuration... |
| 9 | if [ ! -f /etc/default/dhcp-server ]; then |
| 10 | echo "/etc/default/dhcp-server does not exist! - Aborting..." |
| 11 | exit 0 |
| 12 | fi |
| 13 | |
| 14 | # Read init script configuration (so far only interfaces the daemon |
| 15 | # should listen on.) |
| 16 | . /etc/default/dhcp-server |
| 17 | |
| 18 | case "$1" in |
| 19 | start) |
| 20 | echo -n "Starting DHCP server: " |
| 21 | test -d /var/lib/dhcp/ || mkdir -p /var/lib/dhcp/ |
| 22 | test -f /var/lib/dhcp/dhcpd.leases || touch /var/lib/dhcp/dhcpd.leases |
| 23 | start-stop-daemon -S -x /usr/sbin/dhcpd -- -q $INTERFACES |
| 24 | echo "." |
| 25 | ;; |
| 26 | stop) |
| 27 | echo -n "Stopping DHCP server: dhcpd3" |
| 28 | start-stop-daemon -K -x /usr/sbin/dhcpd |
| 29 | echo "." |
| 30 | ;; |
| 31 | restart | force-reload) |
| 32 | $0 stop |
| 33 | sleep 2 |
| 34 | $0 start |
| 35 | if [ "$?" != "0" ]; then |
| 36 | exit 1 |
| 37 | fi |
| 38 | ;; |
| 39 | *) |
| 40 | echo "Usage: /etc/init.d/dhcp-server {start|stop|restart|force-reload}" |
| 41 | exit 1 |
| 42 | esac |
| 43 | |
| 44 | exit 0 |