#!/usr/bin/sh #---------------------------------------------------------------------------- # /usr/libexec/dhcp/dhcpd - script for dhcp server # # Creation: 2002-12-25 od # Last Update: $Id$ # # Copyright (c) 2018-@@YEAR@@ the eisfair team, team(at)eisfair(dot)org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- NAME=dhcpd DAEMON=/usr/sbin/dhcpd PIDFILE_dhcpd=/run/dhcpd.pid # include eislib #. /var/install/include/eislib #. /etc/init.d/functions # include configuration . /etc/config.d/dhcpd [ -e /etc/config.d/dhcpd_debug ] && . /etc/config.d/dhcpd_debug # --------------------------------------------------------------------------- # stop # --------------------------------------------------------------------------- stop_dhcpd() { killproc -p ${PIDFILE_dhcpd} ${DAEMON} } # --------------------------------------------------------------------------- # start # --------------------------------------------------------------------------- start_dhcpd() { # /var/install/config.d/dhcpd.sh ${dhcpd_v} --quiet --createconf # sleep 3 dhcpd_interface="$(sed -ne 's/^# dhcpd-interfaces \(.*\);$/\1/p' /etc/dhcpd.conf)" if [ -z "${dhcpd_interface}" ] then echo "No interfaces defined for dhcpd service!" return 1 fi debug_daemon= [ "${DHCPD_DEBUG_DEAMON_TRACE:-no}" = "yes" ] && debug_daemon="-tf /var/log/dhcpd.trc" # loadproc -p ${PIDFILE_dhcpd} ${DAEMON} \ ${DAEMON} -pf ${PIDFILE_dhcpd} \ ${dhcpd_v} \ -cf /etc/dhcpd.conf \ -lf /var/lib/dhcp/dhcpd.leases \ $debug_daemon \ $dhcpd_interface &> /var/log/rc.dhcpd.log } # --------------------------------------------------------------------------- # status # --------------------------------------------------------------------------- status_dhcpd() { statusproc -p ${PIDFILE_dhcpd} ${DAEMON} } # --------------------------------------------------------------------------- # reload # --------------------------------------------------------------------------- reload_dhcpd() { killproc -p ${PIDFILE_dhcpd} ${DAEMON} # /var/install/config.d/dhcpd.sh --quiet dhcpd_interface="$(sed -ne 's/^# dhcpd-interfaces \(.*\);$/\1/p' /etc/dhcpd.conf)" #loadproc -p ${PIDFILE_dhcpd} ${DAEMON} -pf ${PIDFILE_dhcpd} \ ${dhcpd_v} \ -cf /etc/dhcpd.conf \ -lf /var/lib/dhcp/dhcpd.leases \ ${dhcpd_interface} } # --------------------------------------------------------------------------- # main # --------------------------------------------------------------------------- dhcpd_v='' while [ ${#} -gt 0 ] do case ${1} in -4) dhcpd_v='-4' shift ;; *) action="${1}" shift ;; esac done case "${action}" in start) # # write new dhcpd.conf during system boot # if basename $0 | grep -qE "^S[0-9][0-9]" # then # /var/install/config.d/dhcpd.sh --quiet # fi start_dhcpd ;; stop) stop_dhcpd ;; # status) # status_dhcpd # ;; # restart) # stop_dhcpd # start_dhcpd # ;; reload) reload_dhcpd ;; # *) # echo "Usage: $0 {start|stop|restart|reload|status}" # ;; esac # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------