aboutsummaryrefslogtreecommitdiff
path: root/package/redis
diff options
context:
space:
mode:
authorGravatar Martin Bark <martin@barkynet.com>2015-07-23 12:20:28 +0100
committerGravatar Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2015-07-23 23:16:31 +0200
commitb386fda5cb95f3a0ef1161f3ec55f632550ad34c (patch)
treee6566ae9803e9afb641026c58bfd9279eb6dfd32 /package/redis
parenta26dd768366452283f749a2f1560b3be3b525dcb (diff)
downloadbuildroot-b386fda5cb95f3a0ef1161f3ec55f632550ad34c.tar.gz
buildroot-b386fda5cb95f3a0ef1161f3ec55f632550ad34c.tar.bz2
package/redis: Add systemV init script
start-stop-daemon is used to start redis-server as user redis in the background. Once redis-server is running we use redis-cli to shutdown cleanly. Signed-off-by: Martin Bark <martin@barkynet.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/redis')
-rw-r--r--package/redis/S50redis38
-rw-r--r--package/redis/redis.mk5
2 files changed, 43 insertions, 0 deletions
diff --git a/package/redis/S50redis b/package/redis/S50redis
new file mode 100644
index 0000000000..c5751d7f44
--- /dev/null
+++ b/package/redis/S50redis
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# start redis
+#
+
+start() {
+ echo -n "Starting redis: "
+ umask 077
+ start-stop-daemon -S -q -c redis:redis -b \
+ --exec /usr/bin/redis-server -- /etc/redis.conf
+ [ $? = 0 ] && echo "OK" || echo "FAIL"
+}
+stop() {
+ echo -n "Stopping redis: "
+ /usr/bin/redis-cli shutdown
+ [ $? = 0 ] && echo "OK" || echo "FAIL"
+}
+restart() {
+ stop
+ start
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart|reload)
+ restart
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}"
+ exit 1
+esac
+
+exit $?
diff --git a/package/redis/redis.mk b/package/redis/redis.mk
index 04c2d6a48a..8537fb2bd2 100644
--- a/package/redis/redis.mk
+++ b/package/redis/redis.mk
@@ -30,4 +30,9 @@ define REDIS_INSTALL_TARGET_CMDS
$(TARGET_DIR)/etc/redis.conf
endef
+define REDIS_INSTALL_INIT_SYSV
+ $(INSTALL) -m 0755 -D package/redis/S50redis \
+ $(TARGET_DIR)/etc/init.d/S50redis
+endef
+
$(eval $(generic-package))