#!/bin/sh
# Steven Shiau <steven@nchc.org.tw>
# License: GPL
# Description: To clean the dhcpd.leases then restart dhcpd

# Load DRBL setting and functions
if [ ! -f "/opt/drbl/sbin/drbl-conf-functions" ]; then
  echo "Unable to find /opt/drbl/sbin/drbl-conf-functions! Program terminated!" 
  exit 1
fi
. /opt/drbl/sbin/drbl-conf-functions

#
check_if_root

#
/etc/init.d/dhcpd stop
[ -f /var/lib/dhcp/dhcpd.leases ] && rm -f /var/lib/dhcp/dhcpd.leases
[ -f /var/lib/dhcp/dhcpd.leases~ ] && rm -f /var/lib/dhcp/dhcpd.leases~
touch /var/lib/dhcp/dhcpd.leases
/etc/init.d/dhcpd start
