summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-db/redis/files/redis.initd')
-rw-r--r--dev-db/redis/files/redis.initd37
1 files changed, 37 insertions, 0 deletions
diff --git a/dev-db/redis/files/redis.initd b/dev-db/redis/files/redis.initd
new file mode 100644
index 000000000000..a7942a8e9340
--- /dev/null
+++ b/dev-db/redis/files/redis.initd
@@ -0,0 +1,37 @@
+#!/sbin/runscript
+# $Header: /var/cvsroot/gentoo-x86/dev-db/redis/files/redis.initd,v 1.1 2010/03/25 07:36:04 robbat2 Exp $
+
+REDIS_EXEC=/usr/sbin/redis-server
+REDIS_PID=${REDIS_PID:-/var/run/redis/redis.pid}
+REDIS_DIR=${REDIS_DIR:-/var/lib/redis}
+REDIS_CONF=${REDIS_CONF:-/etc/redis.conf}
+REDIS_OPTS=${REDIS_OPTS:-"${REDIS_CONF}"}
+REDIS_USER=${REDIS_USER:-redis}
+REDIS_GROUP=${REDIS_GROUP:-redis}
+
+opts="start stop restart"
+
+depend() {
+ use net localmount logger
+ after keepalived
+}
+
+start() {
+ ebegin "Starting Redis server"
+ cd "${REDIS_DIR}"
+ start-stop-daemon --start \
+ --chuid ${REDIS_USER}:${REDIS_GROUP} \
+ --pidfile "${REDIS_PID}" \
+ --exec "${REDIS_EXEC}" \
+ -- ${REDIS_OPTS}
+ ret=$?
+ eend ${ret}
+}
+
+stop() {
+ ebegin "Stopping Redis server"
+ start-stop-daemon --stop --quiet --pidfile "${REDIS_PID}"
+ ret=$?
+ rm -f "${REDIS_PID}"
+ eend ${ret}
+}