cfengine/rc.cfengine

Thu, 04 Oct 2012 20:30:05 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 04 Oct 2012 20:30:05 +0200
changeset 715
c10fb90893b9
parent 562
fb1ea36eaee4
permissions
-rw-r--r--

Correct out of date build configuration, porting to Solaris 11 network
link infrastructure and new libpcap logic. This additionally allows for
device drivers in subdirectories of /dev. Correct packaged nmap
personalities and signatures to work out of the box. Finally, hack
arpd logic to properly close sockets and quit on TERM by repeating
signaling in the run command script. Sadly, all this fails to correct
the run time behaviour of honeyd which fails to bind to the IP layer.

     1 #!@l_prefix@/bin/openpkg rc
     2 ##
     3 ##  rc.cfengine -- Run-Commands
     4 ##
     6 %config
     7     cfengine_enable="$openpkg_rc_def"
     8     cfengine_cfserverd_flags=""
     9     cfengine_cfexecd_flags=""
    10     cfengine_cfmonitord_flags=""
    11     cfengine_log_prolog="true"
    12     cfengine_log_epilog="true"
    13     cfengine_log_numfiles="10"
    14     cfengine_log_minsize="1M"
    15     cfengine_log_complevel="9"
    17 %common
    18     cfengine_cfserverd_pidfile="@l_prefix@/var/cfengine/cf-serverd.pid"
    19     cfengine_cfexecd_pidfile="@l_prefix@/var/cfengine/cf-execd.pid"
    20     cfengine_cfmonitord_pidfile="@l_prefix@/var/cfengine/cf-monitord.pid"
    21     cfengine_signal () {
    22         [ -f $cfengine_cfserverd_pidfile ] \
    23             && kill -$1 `cat $cfengine_cfserverd_pidfile`
    24         local rc=$?
    25         [ -f $cfengine_cfexecd_pidfile ] \
    26             && kill -$1 `cat $cfengine_cfexecd_pidfile` \
    27             || [ $rc -eq 0 ]
    28         [ -f $cfengine_cfmonitord_pidfile ] \
    29             && kill -$1 `cat $cfengine_cfmonitord_pidfile` \
    30             || [ $rc -eq 0 ]
    31     }
    33 %status -u @l_susr@ -o
    34     cfengine_usable="unknown"
    35     cfengine_active="no"
    36     rcService cfengine enable yes && \
    37         cfengine_signal 0 && cfengine_active="yes"
    38     echo "cfengine_enable=\"$cfengine_enable\""
    39     echo "cfengine_usable=\"$cfengine_usable\""
    40     echo "cfengine_active=\"$cfengine_active\""
    42 %start -u @l_susr@
    43     rcService cfengine enable yes || exit 0
    44     rcService cfengine active yes && exit 0
    45     @l_prefix@/var/cfengine/bin/cf-serverd $cfengine_cfserverd_flags 
    46     @l_prefix@/var/cfengine/bin/cf-execd $cfengine_cfexecd_flags 
    47     @l_prefix@/var/cfengine/bin/cf-monitord $cfengine_cfmonitord_flags 
    49 %stop -u @l_susr@
    50     rcService cfengine enable yes || exit 0
    51     rcService cfengine active no  && exit 0
    52     cfengine_signal TERM
    53     sleep 2
    54     rm -f $cfengine_cfserverd_pidfile 2>/dev/null || true
    55     rm -f $cfengine_cfexecd_pidfile  2>/dev/null || true
    56     rm -f $cfengine_cfmonitord_pidfile  2>/dev/null || true
    58 %restart -u @l_susr@
    59     rcService cfengine enable yes || exit 0
    60     rcService cfengine active no  && exit 0
    61     rc cfengine stop start
    63 %daily -u @l_susr@
    64     rcService cfengine enable yes || exit 0
    65     shtool rotate -f \
    66         -n ${cfengine_log_numfiles} -s ${cfengine_log_minsize} -d \
    67         -z ${cfengine_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \
    68         -P "${cfengine_log_prolog}" \
    69         -E "${cfengine_log_epilog}" \
    70         @l_prefix@/var/cfengine/cfengine.log

mercurial