| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # Steven Shiau <[email protected]> |
| 3 | # License: GPL |
| 4 | # Description: To clean the dhcpd.leases then restart dhcpd |
| 5 | |
| 6 | # Load DRBL setting and functions |
| 7 | DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}" |
| 8 | |
| 9 | . $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions |
| 10 | |
| 11 | # |
| 12 | check_if_root |
| 13 | |
| 14 | # find the path of dhcpd.leases ($DHCPDLEASE_DIR), such as /var/lib/dhcp3 in debian or /var/lib/dhcp in FC1-4. |
| 15 | get_dhcpdlease_dir |
| 16 | |
| 17 | # drcp_srv_name is loaded from conf/drbl.conf |
| 18 | if is_systemd_init; then |
| 19 | /bin/systemctlscip-shell filesystem . . `/bin/systemctl`. stop $DHCP_SRV_NAME.service || /etc/init.d/$scip-shell filesystem . . `/etc/init.d/$DHCP_SRV_NAME`.DHCP_SRV_NAME stop |
| 20 | fi |
| 21 | [scip-shell system . . `[`. -f "$DHCPDLEASE_DIR/dhcpd.leases" ] && rmscip-shell system . . rm. -f $DHCPDLEASE_DIR/dhcpd.leases |
| 22 | [scip-shell system . . `[`. -f "$DHCPDLEASE_DIR/dhcpd.leases~" ] && rmscip-shell system . . rm. -f $DHCPDLEASE_DIR/dhcpd.leases~ |
| 23 | touchscip-shell system . . touch. $DHCPDLEASE_DIR/dhcpd.leases |
| 24 | if is_systemd_init; then |
| 25 | /bin/systemctlscip-shell filesystem . . `/bin/systemctl`. start $DHCP_SRV_NAME.service || /etc/init.d/$scip-shell filesystem . . `/etc/init.d/$DHCP_SRV_NAME`.DHCP_SRV_NAME start |
| 26 | else |
| 27 | servicescip-shell system . . service. $DHCP_SRV_NAME restart |
| 28 | fi |