Wed, 21 Sep 2011 14:10:37 +0200
Import package vendor original specs for necessary manipulations.
1 #!@l_prefix@/bin/openpkg rc
2 ##
3 ## rc.memcached -- Run-Commands
4 ##
6 %config
7 memcached_enable="$openpkg_rc_def"
8 memcached_daemon="yes"
9 memcached_flags="-l 127.0.0.1 -p 11211"
10 memcached_log_prolog="true"
11 memcached_log_epilog="true"
12 memcached_log_numfiles="10"
13 memcached_log_minsize="1M"
14 memcached_log_complevel="9"
16 %common
17 memcached_pidfile="@l_prefix@/var/memcached/memcached.pid"
18 memcached_signal () {
19 [ -f $memcached_pidfile ] && kill -$1 `cat $memcached_pidfile`
20 }
22 %status -u @l_susr@ -o
23 memcached_usable="unknown"
24 memcached_active="no"
25 rcService memcached enable yes && \
26 memcached_signal 0 && memcached_active="yes"
27 echo "memcached_enable=\"$memcached_enable\""
28 echo "memcached_usable=\"$memcached_usable\""
29 echo "memcached_active=\"$memcached_active\""
31 %start -p 100 -u @l_susr@
32 rcService memcached enable yes || exit 0
33 rcService memcached active yes && exit 0
34 rcVarIsYes memcached_daemon || exit 0
35 @l_prefix@/bin/memcached \
36 -d -u @l_nusr@ \
37 -P $memcached_pidfile \
38 $memcached_flags
40 %stop -p 900 -u @l_susr@
41 rcService memcached enable yes || exit 0
42 rcService memcached active no && exit 0
43 rcVarIsYes memcached_daemon || exit 0
44 memcached_signal TERM
45 sleep 2
46 rm -f $memcached_pidfile >/dev/null 2>&1 || true
48 %restart -p 100 -u @l_susr@
49 rcService memcached enable yes || exit 0
50 rcService memcached active no && exit 0
51 rcVarIsYes memcached_daemon || exit 0
52 rc memcached stop start
54 %daily -u @l_susr@
55 rcService memcached enable yes || exit 0
56 rcVarIsYes memcached_daemon || exit 0
57 shtool rotate -f \
58 -n $memcached_log_numfiles -s $memcached_log_minsize -d \
59 -z $memcached_log_complevel -m 644 -o @l_nusr@ -g @l_ngrp@ \
60 -P "$memcached_log_prolog" \
61 -E "$memcached_log_epilog && rc memcached reload" \
62 @l_prefix@/var/memcached/memcached.log