]> rtime.felk.cvut.cz Git - coffee/buildroot.git/commitdiff
package/redis: Add systemV init script
authorMartin Bark <martin@barkynet.com>
Thu, 23 Jul 2015 11:20:28 +0000 (12:20 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thu, 23 Jul 2015 21:16:31 +0000 (23:16 +0200)
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>
package/redis/S50redis [new file with mode: 0644]
package/redis/redis.mk

diff --git a/package/redis/S50redis b/package/redis/S50redis
new file mode 100644 (file)
index 0000000..c5751d7
--- /dev/null
@@ -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 $?
index 04c2d6a48a3ff2a4ff3e3ed7f06f0cfc36f7330f..8537fb2bd2a0cb29ff66514c9c746115c3c0d9b7 100644 (file)
@@ -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))