memcached/rc.memcached

changeset 378
16cc9d2eceb2
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/memcached/rc.memcached	Wed Sep 21 14:10:37 2011 +0200
     1.3 @@ -0,0 +1,63 @@
     1.4 +#!@l_prefix@/bin/openpkg rc
     1.5 +##
     1.6 +##  rc.memcached -- Run-Commands
     1.7 +##
     1.8 +
     1.9 +%config
    1.10 +    memcached_enable="$openpkg_rc_def"
    1.11 +    memcached_daemon="yes"
    1.12 +    memcached_flags="-l 127.0.0.1 -p 11211"
    1.13 +    memcached_log_prolog="true"
    1.14 +    memcached_log_epilog="true"
    1.15 +    memcached_log_numfiles="10"
    1.16 +    memcached_log_minsize="1M"
    1.17 +    memcached_log_complevel="9"
    1.18 +
    1.19 +%common
    1.20 +    memcached_pidfile="@l_prefix@/var/memcached/memcached.pid"
    1.21 +    memcached_signal () {
    1.22 +        [ -f $memcached_pidfile ] && kill -$1 `cat $memcached_pidfile`
    1.23 +    }
    1.24 +
    1.25 +%status -u @l_susr@ -o
    1.26 +    memcached_usable="unknown"
    1.27 +    memcached_active="no"
    1.28 +    rcService memcached enable yes && \
    1.29 +        memcached_signal 0 && memcached_active="yes"
    1.30 +    echo "memcached_enable=\"$memcached_enable\""
    1.31 +    echo "memcached_usable=\"$memcached_usable\""
    1.32 +    echo "memcached_active=\"$memcached_active\""
    1.33 +
    1.34 +%start -p 100 -u @l_susr@
    1.35 +    rcService memcached enable yes || exit 0
    1.36 +    rcService memcached active yes && exit 0
    1.37 +    rcVarIsYes memcached_daemon || exit 0
    1.38 +    @l_prefix@/bin/memcached \
    1.39 +        -d -u @l_nusr@ \
    1.40 +        -P $memcached_pidfile \
    1.41 +        $memcached_flags
    1.42 +
    1.43 +%stop -p 900 -u @l_susr@
    1.44 +    rcService memcached enable yes || exit 0
    1.45 +    rcService memcached active no  && exit 0
    1.46 +    rcVarIsYes memcached_daemon || exit 0
    1.47 +    memcached_signal TERM
    1.48 +    sleep 2
    1.49 +    rm -f $memcached_pidfile >/dev/null 2>&1 || true
    1.50 +
    1.51 +%restart -p 100 -u @l_susr@
    1.52 +    rcService memcached enable yes || exit 0
    1.53 +    rcService memcached active no  && exit 0
    1.54 +    rcVarIsYes memcached_daemon || exit 0
    1.55 +    rc memcached stop start
    1.56 +
    1.57 +%daily -u @l_susr@
    1.58 +    rcService memcached enable yes || exit 0
    1.59 +    rcVarIsYes memcached_daemon || exit 0
    1.60 +    shtool rotate -f \
    1.61 +        -n $memcached_log_numfiles -s $memcached_log_minsize -d \
    1.62 +        -z $memcached_log_complevel -m 644 -o @l_nusr@ -g @l_ngrp@ \
    1.63 +        -P "$memcached_log_prolog" \
    1.64 +        -E "$memcached_log_epilog && rc memcached reload" \
    1.65 +        @l_prefix@/var/memcached/memcached.log
    1.66 +

mercurial