#!/bin/sh # DHCP Server # # chkconfig: 345 80 20 # description: DHCP Server # Source function library . /etc/rc.d/init.d/functions # Get network config . /etc/sysconfig/network # Get service config [ -f /etc/sysconfig/dhcp ] && . /etc/sysconfig/dhcp # Check that networking is up. [ "${NETWORKING}" = "no" ] && echo "Error: Networking is down" && exit 0 # See how we were called. case "$1" in start) # Check if the service is already running? if [ ! -f /var/lock/subsys/dhcpd ]; then show Starting dhcpd daemon dhcpd else echo "dhcpd already is running" fi touch /var/lock/subsys/dhcpd show Starting DHCP Server daemon dhcpd touch /var/lock/subsys/dhcpd ;; stop) show Stopping DHCP Server killproc dhcpd rm -f /var/run/dhcpd.pid rm -f /var/lock/subsys/dhcpd ;; restart|reload) $0 stop $0 start ;; status) status dhcpd ;; *) echo "Usage: $0 {start|stop|restart|reload|status}" exit 1 esac exit 0