1. Audrius Kažukauskas
  2. slackbuilds

Commits

Audrius Kažukauskas  committed 2930963

system/redis: Wait for redis to shutdown in init script.

  • Participants
  • Parent commits 1c8623d
  • Branches default

Comments (0)

Files changed (1)

File system/redis/rc.redis.new

View file
  • Ignore whitespace
 PORT=6379
 SERV=/usr/bin/redis-server
 CLI=/usr/bin/redis-cli
-PID=/var/run/redis.pid
+PIDFILE=/var/run/redis.pid
 CONF=/etc/redis.conf
 
 redis_start() {
     exit 1
   fi
 
-  if [ -s $PID ]; then
+  if [ -s $PIDFILE ]; then
     echo "Redis appears to be already running?"
     exit 1
   fi
 }
 
 redis_stop() {
-  if [ ! -r $PID ]; then
-    echo "$PID does not exist."
+  if [ ! -s $PIDFILE ]; then
+    echo "$PIDFILE does not exist or is empty."
     exit 1
   fi
 
-  echo "Stopping Redis server..."
+  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() {