summaryrefslogtreecommitdiff
path: root/redis/redis.rc
blob: 006ce0d051ef0fe69234819425a20b217a16c30d (plain)
    1 #!/bin/sh
    2 #
    3 # /etc/rc.d/redis: start/stop redis server
    4 #
    5 # make sure to have set daemonize to no in redis.conf so that PID file
    6 # creation and tracking by start-stop-daemon work properly
    7 
    8 SSD=/sbin/start-stop-daemon
    9 PROG=/usr/bin/redis-server
   10 PID=/var/run/redis.pid
   11 USR=redis
   12 RDBDIR=/var/lib/redis
   13 
   14 case $1 in
   15 start)
   16         $SSD --start -c $USR -b -m --pidfile $PID --exec $PROG -- /etc/redis.conf
   17         ;;
   18 stop)
   19         $SSD --stop --retry 10 --pidfile $PID --remove-pidfile
   20         ;;
   21 restart)
   22         $0 stop
   23         $0 start
   24         ;;
   25 status)
   26         $SSD --status --pidfile $PID
   27         case $? in
   28         0) echo "$PROG is running with pid $(cat $PID)" ;;
   29         1) echo "$PROG is not running but the pid file $PID exists" ;;
   30         3) echo "$PROG is not running" ;;
   31         4) echo "Unable to determine the program status" ;;
   32         esac
   33         ;;
   34 *)
   35         echo "usage: $0 [start|stop|restart|status]"
   36         ;;
   37 esac
   38 
   39 # End of file

Generated by cgit