3 # redis init file for starting up the redis daemon
7 # description: Starts and stops the redis daemon.
8 # processname: redis-server
10 # Source function library
11 . /etc/rc.d/init.d/functions
14 . /etc/sysconfig/network
16 # Check that networking is up.
17 if is_yes "${NETWORKING}"; then
18 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
19 msg_network_down "Redis"
26 REDIS_CONFIG="/etc/redis.conf"
29 # Get service config - may override defaults
30 [ -f /etc/sysconfig/redis ] && . /etc/sysconfig/redis
32 pidfile="/var/run/redis/redis.pid"
35 # Check if the service is already running?
36 if [ -f /var/lock/subsys/redis ]; then
37 msg_already_running "Redis"
42 daemon --user ${REDIS_USER:-redis} /usr/sbin/redis-server $REDIS_CONFIG
44 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/redis
48 if [ ! -f /var/lock/subsys/redis ]; then
49 msg_not_running "Redis"
55 killproc --pidfile $pidfile redis-server -TERM
56 rm -f /var/lock/subsys/redis
60 if [ ! -f /var/lock/subsys/redis ]; then
61 msg_not_running "Redis"
71 # See how we were called.
90 status --pidfile $pidfile redis redis-server
94 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"