ports/contrib (3.2): dhcp: add ssd-based scripts, thanks frinnst!
commit cfae243d3544ee0a1d19f890439df44af2ac3490 Author: Thomas Penteker <tek@serverop.de> Date: Mon Nov 30 01:12:35 2015 +0100 dhcp: add ssd-based scripts, thanks frinnst! diff --git a/dhcp/.md5sum b/dhcp/.md5sum index b040581..21a03a3 100644 --- a/dhcp/.md5sum +++ b/dhcp/.md5sum @@ -1,4 +1,4 @@ 157549658aba092b0d26aa1df3943051 default-config.diff -2c0abf8990ab061accefc5d3d0f655d1 dhclient +d668fba757e27f197729972750f89859 dhclient c5577b09c9017cdd319a11ff6364268e dhcp-4.3.3.tar.gz -51665125f8360c6cc1ef59ad6cd8cf84 dhcpd +3d6b3dbd3cabb0efcfada56cd3e6c0a4 dhcpd diff --git a/dhcp/dhclient b/dhcp/dhclient index 75501f7..9163753 100644 --- a/dhcp/dhclient +++ b/dhcp/dhclient @@ -3,21 +3,38 @@ # /etc/rc.d/dhcpcd: start/stop dhcp client # +SSD=/sbin/start-stop-daemon +PROG=/usr/sbin/dhclient +PID=/var/run/dhclient.pid +OPTS="-q" + case $1 in start) - /usr/sbin/dhclient -q - ;; + $SSD --start --pidfile $PID --exec $PROG -- $OPTS + ;; stop) - test -f /var/run/dhclient.pid && kill $(cat /var/run/dhclient.pid) - ;; + $SSD --stop --remove-pidfile --retry 10 --pidfile $PID + ;; restart) - $0 stop - sleep 1 - $0 start - ;; + $0 stop + $0 start + ;; +reload) + $SSD --stop --signal HUP --pidfile $PID + ;; +status) + $SSD --status --pidfile $PID + case $? in + 0) echo "$PROG is running" ;; + 1) echo "$PROG is not running but the pid file $PID exists" ;; + 3) echo "$PROG is not running" ;; + 4) echo "Unable to determine the program status" ;; + esac + ;; *) - echo "usage: $0 [start|stop|restart]" - ;; + echo "usage: $0 [start|stop|restart|reload|status]" + ;; esac # End of file + diff --git a/dhcp/dhcpd b/dhcp/dhcpd index bf4fe5f..0c7898a 100644 --- a/dhcp/dhcpd +++ b/dhcp/dhcpd @@ -3,21 +3,37 @@ # /etc/rc.d/dhcpd: start/stop dhcp daemon # +SSD=/sbin/start-stop-daemon +PROG=/usr/sbin/dhcpd +PID=/var/run/dhcpd.pid +OPTS="-q" + case $1 in start) - /usr/sbin/dhcpd -q - ;; + $SSD --start --pidfile $PID --exec $PROG -- $OPTS + ;; stop) - killall -q /usr/sbin/dhcpd - ;; + $SSD --stop --remove-pidfile --retry 10 --pidfile $PID + ;; restart) - $0 stop - sleep 1 - $0 start - ;; + $0 stop + $0 start + ;; +reload) + $SSD --stop --signal HUP --pidfile $PID + ;; +status) + $SSD --status --pidfile $PID + case $? in + 0) echo "$PROG is running" ;; + 1) echo "$PROG is not running but the pid file $PID exists" ;; + 3) echo "$PROG is not running" ;; + 4) echo "Unable to determine the program status" ;; + esac + ;; *) - echo "usage: $0 [start|stop|restart]" - ;; + echo "usage: $0 [start|stop|restart|reload|status]" + ;; esac # End of file
participants (1)
-
crux@crux.nu