Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
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