cfengine/rc.cfengine

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 562
fb1ea36eaee4
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

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

mercurial