#!/bin/sh
# 
# $FreeBSD: ports/databases/memcacheq/files/memcacheq.in,v 1.4 2012/11/17 05:55:10 svnexp Exp $
#

# PROVIDE: memcacheq
# REQUIRE: LOGIN
# KEYWORD: shutdown

# 
# Add the following lines to /etc/rc.conf to run memcacheq:
#
# memcacheq_enable (bool):	Set it to "YES" to enable memcacheq.
#				Default is "NO".
# memcacheq_flags (flags):	Set extra flags here.
#				Default is "-N -H /var/db/memcacheq -R -L 1024 -B 1024"
# memcacheq_user (user):	Set user to run memcacheq.
#				Default is "nobody".
#

. /etc/rc.subr

name="memcacheq"
rcvar=memcacheq_enable
sig_stop=KILL

load_rc_config ${name}

: ${memcacheq_enable="NO"}
: ${memcacheq_user="nobody"}
: ${memcacheq_flags="-N -H /var/db/memcacheq -R -L 1024 -B 1024"}

start_precmd="install -d -o $memcacheq_user -g wheel -m 700 /var/run/${name}"

command=/usr/local/bin/memcacheq
command_args="-u ${memcacheq_user} -P /var/run/${name}/${name}.pid -d"

run_rc_command "$1"
