diff -r 67e813202d53 -r 16cc9d2eceb2 memcached/rc.memcached --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memcached/rc.memcached Wed Sep 21 14:10:37 2011 +0200 @@ -0,0 +1,63 @@ +#!@l_prefix@/bin/openpkg rc +## +## rc.memcached -- Run-Commands +## + +%config + memcached_enable="$openpkg_rc_def" + memcached_daemon="yes" + memcached_flags="-l 127.0.0.1 -p 11211" + memcached_log_prolog="true" + memcached_log_epilog="true" + memcached_log_numfiles="10" + memcached_log_minsize="1M" + memcached_log_complevel="9" + +%common + memcached_pidfile="@l_prefix@/var/memcached/memcached.pid" + memcached_signal () { + [ -f $memcached_pidfile ] && kill -$1 `cat $memcached_pidfile` + } + +%status -u @l_susr@ -o + memcached_usable="unknown" + memcached_active="no" + rcService memcached enable yes && \ + memcached_signal 0 && memcached_active="yes" + echo "memcached_enable=\"$memcached_enable\"" + echo "memcached_usable=\"$memcached_usable\"" + echo "memcached_active=\"$memcached_active\"" + +%start -p 100 -u @l_susr@ + rcService memcached enable yes || exit 0 + rcService memcached active yes && exit 0 + rcVarIsYes memcached_daemon || exit 0 + @l_prefix@/bin/memcached \ + -d -u @l_nusr@ \ + -P $memcached_pidfile \ + $memcached_flags + +%stop -p 900 -u @l_susr@ + rcService memcached enable yes || exit 0 + rcService memcached active no && exit 0 + rcVarIsYes memcached_daemon || exit 0 + memcached_signal TERM + sleep 2 + rm -f $memcached_pidfile >/dev/null 2>&1 || true + +%restart -p 100 -u @l_susr@ + rcService memcached enable yes || exit 0 + rcService memcached active no && exit 0 + rcVarIsYes memcached_daemon || exit 0 + rc memcached stop start + +%daily -u @l_susr@ + rcService memcached enable yes || exit 0 + rcVarIsYes memcached_daemon || exit 0 + shtool rotate -f \ + -n $memcached_log_numfiles -s $memcached_log_minsize -d \ + -z $memcached_log_complevel -m 644 -o @l_nusr@ -g @l_ngrp@ \ + -P "$memcached_log_prolog" \ + -E "$memcached_log_epilog && rc memcached reload" \ + @l_prefix@/var/memcached/memcached.log +