]> git.saurik.com Git - redis.git/blob - utils/redis_init_script
ziplist.c fixes for bigendian
[redis.git] / utils / redis_init_script
1 #!/bin/sh
2 #
3 # Simple Redis init.d script conceived to work on Linux systems
4 # as it does use of the /proc filesystem.
5
6 REDISPORT=6379
7 EXEC=/usr/local/bin/redis-server
8 CLIEXEC=/usr/local/bin/redis-cli
9
10 PIDFILE=/var/run/redis_${REDISPORT}.pid
11 CONF="/etc/redis/${REDISPORT}.conf"
12
13 case "$1" in
14 start)
15 if [ -f $PIDFILE ]
16 then
17 echo "$PIDFILE exists, process is already running or crashed"
18 else
19 echo "Starting Redis server..."
20 $EXEC $CONF
21 fi
22 ;;
23 stop)
24 if [ ! -f $PIDFILE ]
25 then
26 echo "$PIDFILE does not exist, process is not running"
27 else
28 PID=$(cat $PIDFILE)
29 echo "Stopping ..."
30 $CLIEXEC -p $REDISPORT shutdown
31 while [ -x /proc/${PID} ]
32 do
33 echo "Waiting for Redis to shutdown ..."
34 sleep 1
35 done
36 echo "Redis stopped"
37 fi
38 ;;
39 *)
40 echo "Please use start or stop as first argument"
41 ;;
42 esac