#!/bin/bash do_start() { echo "starting dhcp daemon" udhcpd -S /etc/udhcpd.conf } do_stop() { echo "stopping dhcp daemon" killall udhcpd } # main if [[ $# -ne 1 ]] then echo "usage: $0 start|stop|restart" exit 1 fi case $1 in start) if [[ ! -f "/etc/udhcpd.conf" ]] then echo "/etc/udhcpd.conf does not exist" exit 1 fi do_start ;; stop) do_stop ;; restart) do_stop do_start ;; esac exit 0