dhcpd/rc.dhcpd

Tue, 28 Aug 2012 18:29:30 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 28 Aug 2012 18:29:30 +0200
changeset 534
d2d0020cfafa
parent 13
cb59d6afeb61
permissions
-rw-r--r--

Update from Drupal 6.x to 7.x and introduce several new HTML5 themes. Because
many themes from Drupal 6.x have since been abandoned, left unmaintained, or
not ported to Drupal 7.x, this package has changed in size and utility.

michael@13 1 #!@l_prefix@/bin/openpkg rc
michael@13 2 ##
michael@13 3 ## rc.dhcpd -- Run-Commands
michael@13 4 ##
michael@13 5
michael@13 6 %config
michael@13 7 dhcpd_enable="$openpkg_rc_def"
michael@13 8 dhcpd_flags="-q"
michael@13 9 dhcpd_if=""
michael@13 10 dhcpd_port="67"
michael@13 11 dhcpd_log_prolog="true"
michael@13 12 dhcpd_log_epilog="true"
michael@13 13 dhcpd_log_numfiles="10"
michael@13 14 dhcpd_log_minsize="1M"
michael@13 15 dhcpd_log_complevel="9"
michael@13 16
michael@13 17 %common
michael@13 18 dhcpd_pidfile="@l_prefix@/var/dhcpd/run/dhcpd.pid"
michael@13 19 dhcpd_leases="@l_prefix@/var/dhcpd/db/dhcpd.leases"
michael@13 20 dhcpd_signal () {
michael@354 21 if [ ! -f $dhcpd_pidfile ]; then return 1; fi
michael@354 22 kill -$1 `cat $dhcpd_pidfile`
michael@13 23 }
michael@13 24 dhcpd_start () {
michael@13 25 if [ ! -f $dhcpd_leases ]; then
michael@13 26 touch $dhcpd_leases
michael@13 27 chmod 644 $dhcpd_leases
michael@13 28 chown @l_susr@:@l_mgrp@ $dhcpd_leases
michael@13 29 fi
michael@13 30 local cmd="@l_prefix@/sbin/dhcpd"
michael@354 31 cmd="$cmd -f"
michael@13 32 cmd="$cmd $dhcpd_flags"
michael@13 33 echo ".$dhcpd_flags" | grep -- -p >/dev/null 2>&1
michael@13 34 if [ $? -ne 0 -a ".$dhcpd_port" != . ]; then
michael@13 35 cmd="$cmd -p $dhcpd_port"
michael@13 36 fi
michael@13 37 if [ $# -gt 0 ]; then
michael@13 38 cmd="$cmd $@"
michael@13 39 fi
michael@354 40 ( eval "nohup $cmd </dev/null >/dev/null 2>&1 &"
michael@354 41 echo $! >$dhcpd_pidfile
michael@354 42 ) >/dev/null 2>&1
michael@13 43 }
michael@13 44
michael@13 45 %status -u @l_susr@ -o
michael@13 46 dhcpd_usable="unknown"
michael@13 47 dhcpd_active="no"
michael@354 48 @l_prefix@/sbin/dhcpd -q -t || dhcpd_usable="no"
michael@13 49 [ ".$dhcpd_if" = . ] && dhcpd_usable="no"
michael@13 50 rcService dhcpd enable yes && \
michael@13 51 dhcpd_signal 0 && dhcpd_active="yes"
michael@13 52 echo "dhcpd_enable=\"$dhcpd_enable\""
michael@13 53 echo "dhcpd_usable=\"$dhcpd_usable\""
michael@13 54 echo "dhcpd_active=\"$dhcpd_active\""
michael@13 55
michael@13 56 %start -u @l_susr@
michael@13 57 rcService dhcpd enable yes || exit 0
michael@13 58 rcService dhcpd usable no && exit 0
michael@13 59 rcService dhcpd active yes && exit 0
michael@13 60 dhcpd_start $dhcpd_if
michael@13 61
michael@13 62 %stop -u @l_susr@
michael@13 63 rcService dhcpd enable yes || exit 0
michael@13 64 rcService dhcpd active no && exit 0
michael@13 65 dhcpd_signal TERM
michael@13 66 sleep 2
michael@13 67 rm -f $dhcpd_pidfile 2>/dev/null || true
michael@13 68
michael@13 69 %restart -u @l_susr@
michael@13 70 rcService dhcpd enable yes || exit 0
michael@13 71 rcService dhcpd active no && exit 0
michael@13 72 rc dhcpd stop start
michael@13 73
michael@13 74 %reload -u @l_susr@
michael@13 75 rcService dhcpd enable yes || exit 0
michael@13 76 dhcpd_signal HUP
michael@13 77
michael@13 78 %daily -u @l_susr@
michael@13 79 rcService dhcpd enable yes || exit 0
michael@13 80 rcTmp -i
michael@13 81 hintfile=`rcTmp -f -n hint`
michael@13 82 for tool in dhcpd dhclient dhrelay omshell; do
michael@13 83 shtool rotate -f \
michael@13 84 -n $dhcpd_log_numfiles -s $dhcpd_log_minsize -d \
michael@13 85 -z $dhcpd_log_complevel -m 644 -o @l_susr@ -g @l_mgrp@ \
michael@13 86 -P "$dhcpd_log_prolog" \
michael@13 87 -E "$dhcpd_log_epilog; echo 1 >$hintfile" \
michael@13 88 @l_prefix@/var/dhcpd/log/$tool.log
michael@13 89 done
michael@13 90 if [ -s $hintfile ]; then
michael@13 91 rc dhcpd restart
michael@13 92 fi
michael@13 93 rcTmp -k
michael@13 94

mercurial