From 7f9a4db3c013b744e11dc7f58026009392b051de Mon Sep 17 00:00:00 2001
From: antirez <antirez@gmail.com>
Date: Thu, 9 Sep 2010 10:24:56 +0200
Subject: [PATCH] Fix for the init script provided with Redis, thanks to Rowan.
 This fixes issue 316

---
 utils/redis_init_script | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/utils/redis_init_script b/utils/redis_init_script
index 35b906fc..b1c56002 100755
--- a/utils/redis_init_script
+++ b/utils/redis_init_script
@@ -21,15 +21,14 @@ case "$1" in
         then
                 echo -n "$PIDFILE does not exist, process is not running\n"
         else
+		PID=$(cat $PIDFILE)
                 echo -n "Stopping ...\n"
-                echo -n "Sending SHUTDOWN\r\n" | nc localhost $REDISPORT &
-                PID=$(cat $PIDFILE)
+                echo -n "SHUTDOWN\r\n" | nc localhost $REDISPORT &
                 while [ -x /proc/${PIDFILE} ]
                 do
                     echo "Waiting for Redis to shutdown ..."
                     sleep 1
                 done
-                rm $PIDFILE
                 echo "Redis stopped"
         fi
         ;;
-- 
2.45.2