You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.9 KiB
70 lines
1.9 KiB
#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc |
|
## |
|
## rc.dhcpd -- Run-Commands |
|
## |
|
|
|
%config |
|
dhcpd_enable="$openpkg_rc_def" |
|
dhcpd_flags="-q" |
|
dhcpd_if="" |
|
dhcpd_port="67" |
|
dhcpd_log_prolog="true" |
|
dhcpd_log_epilog="true" |
|
dhcpd_log_numfiles="10" |
|
dhcpd_log_minsize="1M" |
|
dhcpd_log_complevel="9" |
|
|
|
%common |
|
dhcpd_pidfile="@l_prefix@/var/dhcpd/dhcpd.pid" |
|
dhcpd_signal () { |
|
[ -f $dhcpd_pidfile ] && kill -$1 `cat $dhcpd_pidfile` |
|
} |
|
|
|
%status -u @l_susr@ -o |
|
dhcpd_usable="unknown" |
|
dhcpd_active="no" |
|
[ ".$dhcpd_if" = . ] && dhcpd_usable="no" |
|
rcService dhcpd enable yes && \ |
|
dhcpd_signal 0 && dhcpd_active="yes" |
|
echo "dhcpd_enable=\"$dhcpd_enable\"" |
|
echo "dhcpd_usable=\"$dhcpd_usable\"" |
|
echo "dhcpd_active=\"$dhcpd_active\"" |
|
|
|
%start -u @l_susr@ |
|
rcService dhcpd enable yes || exit 0 |
|
rcService dhcpd usable no && exit 0 |
|
rcService dhcpd active yes && exit 0 |
|
flags="$dhcpd_flags" |
|
echo $flags | grep -- -p >/dev/null |
|
if [ $? -ne 0 -a ".$dhcpd_port" != . ]; then |
|
flags="$flags -p $dhcpd_port" |
|
fi |
|
@l_prefix@/sbin/dhcpd $flags $dhcpd_if >/dev/null 2>&1 |
|
|
|
%stop -u @l_susr@ |
|
rcService dhcpd enable yes || exit 0 |
|
rcService dhcpd active no && exit 0 |
|
dhcpd_signal TERM |
|
sleep 2 |
|
rm -f $dhcpd_pidfile 2>/dev/null || true |
|
|
|
%restart -u @l_susr@ |
|
rcService dhcpd enable yes || exit 0 |
|
rcService dhcpd active no && exit 0 |
|
rc dhcpd stop start |
|
|
|
%reload -u @l_susr@ |
|
rcService dhcpd enable yes || exit 0 |
|
dhcpd_signal HUP |
|
|
|
%daily -u @l_susr@ |
|
rcService dhcpd enable yes || exit 0 |
|
|
|
# rotate logfile |
|
shtool rotate -f \ |
|
-n ${dhcpd_log_numfiles} -s ${dhcpd_log_minsize} -d \ |
|
-z ${dhcpd_log_complevel} -m 644 -o @l_susr@ -g @l_mgrp@ \ |
|
-P "${dhcpd_log_prolog}" \ |
|
-E "${dhcpd_log_epilog} && rc dhcpd restart" \ |
|
@l_prefix@/var/dhcpd/dhcpd.log |
|
|
|
|