diff options
author | Audrius Kažukauskas <audrius@neutrino.lt> | 2012-12-02 12:35:22 -0500 |
---|---|---|
committer | dsomero <xgizzmo@slackbuilds.org> | 2012-12-11 16:21:54 -0500 |
commit | 5a09ed3366b1eddabd0bd5ed8a089035694f7b35 (patch) | |
tree | 30704227f082c6fca8d95e8b517b9c49e9cc82fb /system/redis/rc.redis.new | |
parent | fd627f875c0e587a5ff992b276fa1cf1a632f157 (diff) |
system/redis: Updated for version 2.6.5
Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
Diffstat (limited to 'system/redis/rc.redis.new')
-rw-r--r-- | system/redis/rc.redis.new | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/system/redis/rc.redis.new b/system/redis/rc.redis.new new file mode 100644 index 0000000000000..f20fde7673ccf --- /dev/null +++ b/system/redis/rc.redis.new @@ -0,0 +1,61 @@ +#!/bin/sh +# +# Redis startup script for Slackware Linux + +PORT=6379 +SERV=/usr/bin/redis-server +CLI=/usr/bin/redis-cli +PIDFILE=/var/run/redis.pid +CONF=/etc/redis.conf + +redis_start() { + if [ ! -r $CONF ]; then + echo "$CONF does not appear to exist. Abort." + exit 1 + fi + + if [ -s $PIDFILE ]; then + echo "Redis appears to be already running?" + exit 1 + fi + + echo "Starting Redis server..." + $SERV $CONF +} + +redis_stop() { + if [ ! -s $PIDFILE ]; then + echo "$PIDFILE does not exist or is empty." + exit 1 + fi + + PID=$(cat $PIDFILE) + echo -n "Stopping Redis server..." + $CLI -p $PORT shutdown + while [ -d /proc/$PID ]; do + sleep 1 + echo -n "." + done + echo " done" +} + +redis_restart() { + redis_stop + sleep 3 + redis_start +} + +case "$1" in + start) + redis_start + ;; + stop) + redis_stop + ;; + restart) + redis_restart + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac |