diff options
Diffstat (limited to 'net-misc/memcached/files/1.1.12/init')
-rw-r--r-- | net-misc/memcached/files/1.1.12/init | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/net-misc/memcached/files/1.1.12/init b/net-misc/memcached/files/1.1.12/init new file mode 100644 index 000000000000..30035c39c80f --- /dev/null +++ b/net-misc/memcached/files/1.1.12/init @@ -0,0 +1,48 @@ +#!/sbin/runscript +# $Id$ + +depend() { + need net +} + +checkconfig() { + if [ -z "${LISTENON}" ]; then + ewarn "You should edit /etc/conf.d/memcached and specify an address to listen on." + ewarn "Listening on any address (I hope your firewall is set up properly)" + fi +} + +start() { + ebegin "Starting memcached" + checkconfig + local dir="$(dirname ${PIDFILE})" + if [ ! -d "${dir}" ]; then + einfo " Creating ${dir}" + mkdir -p "${dir}" + fi + chown ${MEMCACHED_RUNAS} "${dir}" + if [ -f ${PIDFILE} ]; then + einfo " Removing stale pidfile ${PIDFILE}" + rm -f ${PIDFILE} 1>/dev/null + fi + + if [ -z "${LISTENON}" ]; then + c_LISTENON="" + else + c_LISTENON="-l ${LISTENON}" + fi + + /sbin/start-stop-daemon --start \ + --exec ${MEMCACHED_BINARY} -- \ + -d -p ${PORT} ${c_LISTENON} -m ${MEMUSAGE} \ + -c ${MAXCONN} -u ${MEMCACHED_RUNAS} -P ${PIDFILE} ${MISC_OPTS} + eend $? +} + +stop() { + ebegin "Stopping memcached" + start-stop-daemon --stop --quiet --pidfile ${PIDFILE} + rm -f ${PIDFILE} + eend $? +} + |