#!/bin/sh
#
### BEGIN INIT INFO
# Provides:          redis-server
# Required-Start:    $network
# Required-Stop:     $network
# Default-Start:     S 2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Redis, a key-value store
# Description:       Redis is an open source, advanced key-value store.
#                    http://redis.io
### END INIT INFO

test -f /usr/bin/redis-server || exit 0

ARGS="/etc/redis/redis.conf"

case "$1" in
    start)
	echo "Starting redis-server..."
        start-stop-daemon --start --quiet --exec /usr/bin/redis-server -- $ARGS
	;;
    stop)
        echo "Stopping redis-server..."
        start-stop-daemon --stop --quiet --exec /usr/bin/redis-server
	;;
    restart)
        echo "Stopping redis-server..."
        start-stop-daemon --stop --quiet --exec /usr/bin/redis-server
	echo "Starting redis-server..."
        start-stop-daemon --start --quiet --exec /usr/bin/redis-server -- $ARGS
	;;
    *)
	echo "Usage: /etc/init.d/redis-server {start|stop|restart}"
	exit 1
	;;
esac

exit 0

