dhcpd/rc.dhcpd

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

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

Massively update modules from Drupal 6.x to 7.x, and add diverse OpenID modules.
Unfortunately many modules available to Drupal 6.x installations have not been
since maintained or ported to 7.x causing this package to diminish in both size
and utility.

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

mercurial