#!/bin/sh
# chkconfig:2345 90 10
# Description:redis is a persistent key-value database
# simple Redis INIT.D script conceived to work on Linux systems
# as it does use of the/proc filesystem.
redisport=6379
Exec=/usr/local/bin/redis-server
Cliexec=/usr/local/bin/redis-cli
Pidfile=/var/run/redis_${redisport}.pid
conf= "/etc/redis/${redisport}.conf"
Case "$" in
Start
If [f $PIDFILE]
Then
echo "$PIDFILE exists, process is already running or crashed"
Else
echo "Starting Redis server ..."
$EXEC $CONF &
Fi
;;
Stop
if [!-F $PIDFILE]
Then
echo "$PIDFILE does not exist, process isn't running"
Else
pid=$ (Cat $PIDFILE)
echo "Stopping ..."
$CLIEXEC-P $REDISPORT shutdown
While [-x/proc/${pid}]
Todo
echo "Waiting for Redis to shutdown ..."
Sleep 1
Done
echo "Redis stopped"
Fi
;;
Restart)
$ stop
$ start
;;
*)
echo "Please use start or stop as the" "Argument"
;;
Esac