Wed, 08 Feb 2012 20:07:00 +0200
Update version, adapt patch, correct PID writing, correct build on newer
FreeBSD releases, and most importantly introduce new patch to try to
avoid segfault caused by multiple network interfaces with the same (or
no) address. This is common when configuring bridges and tunnels.
michael@378 | 1 | #!@l_prefix@/bin/openpkg rc |
michael@378 | 2 | ## |
michael@378 | 3 | ## rc.memcached -- Run-Commands |
michael@378 | 4 | ## |
michael@378 | 5 | |
michael@378 | 6 | %config |
michael@378 | 7 | memcached_enable="$openpkg_rc_def" |
michael@378 | 8 | memcached_daemon="yes" |
michael@378 | 9 | memcached_flags="-l 127.0.0.1 -p 11211" |
michael@378 | 10 | memcached_log_prolog="true" |
michael@378 | 11 | memcached_log_epilog="true" |
michael@378 | 12 | memcached_log_numfiles="10" |
michael@378 | 13 | memcached_log_minsize="1M" |
michael@378 | 14 | memcached_log_complevel="9" |
michael@378 | 15 | |
michael@378 | 16 | %common |
michael@378 | 17 | memcached_pidfile="@l_prefix@/var/memcached/memcached.pid" |
michael@378 | 18 | memcached_signal () { |
michael@378 | 19 | [ -f $memcached_pidfile ] && kill -$1 `cat $memcached_pidfile` |
michael@378 | 20 | } |
michael@378 | 21 | |
michael@378 | 22 | %status -u @l_susr@ -o |
michael@378 | 23 | memcached_usable="unknown" |
michael@378 | 24 | memcached_active="no" |
michael@378 | 25 | rcService memcached enable yes && \ |
michael@378 | 26 | memcached_signal 0 && memcached_active="yes" |
michael@378 | 27 | echo "memcached_enable=\"$memcached_enable\"" |
michael@378 | 28 | echo "memcached_usable=\"$memcached_usable\"" |
michael@378 | 29 | echo "memcached_active=\"$memcached_active\"" |
michael@378 | 30 | |
michael@378 | 31 | %start -p 100 -u @l_susr@ |
michael@378 | 32 | rcService memcached enable yes || exit 0 |
michael@378 | 33 | rcService memcached active yes && exit 0 |
michael@378 | 34 | rcVarIsYes memcached_daemon || exit 0 |
michael@378 | 35 | @l_prefix@/bin/memcached \ |
michael@378 | 36 | -d -u @l_nusr@ \ |
michael@378 | 37 | -P $memcached_pidfile \ |
michael@378 | 38 | $memcached_flags |
michael@378 | 39 | |
michael@378 | 40 | %stop -p 900 -u @l_susr@ |
michael@378 | 41 | rcService memcached enable yes || exit 0 |
michael@378 | 42 | rcService memcached active no && exit 0 |
michael@378 | 43 | rcVarIsYes memcached_daemon || exit 0 |
michael@378 | 44 | memcached_signal TERM |
michael@378 | 45 | sleep 2 |
michael@378 | 46 | rm -f $memcached_pidfile >/dev/null 2>&1 || true |
michael@378 | 47 | |
michael@378 | 48 | %restart -p 100 -u @l_susr@ |
michael@378 | 49 | rcService memcached enable yes || exit 0 |
michael@378 | 50 | rcService memcached active no && exit 0 |
michael@378 | 51 | rcVarIsYes memcached_daemon || exit 0 |
michael@378 | 52 | rc memcached stop start |
michael@378 | 53 | |
michael@378 | 54 | %daily -u @l_susr@ |
michael@378 | 55 | rcService memcached enable yes || exit 0 |
michael@378 | 56 | rcVarIsYes memcached_daemon || exit 0 |
michael@378 | 57 | shtool rotate -f \ |
michael@378 | 58 | -n $memcached_log_numfiles -s $memcached_log_minsize -d \ |
michael@378 | 59 | -z $memcached_log_complevel -m 644 -o @l_nusr@ -g @l_ngrp@ \ |
michael@378 | 60 | -P "$memcached_log_prolog" \ |
michael@378 | 61 | -E "$memcached_log_epilog && rc memcached reload" \ |
michael@378 | 62 | @l_prefix@/var/memcached/memcached.log |
michael@378 | 63 |