2
0

redis_init_script.tpl 822 B

12345678910111213141516171819202122232425262728293031
  1. case "$1" in
  2. start)
  3. if [ -f $$PIDFILE ]
  4. then
  5. echo "$PIDFILE exists, process is already running or crashed"
  6. else
  7. echo "Starting Redis server..."
  8. $EXEC $CONF
  9. fi
  10. ;;
  11. stop)
  12. if [ ! -f $PIDFILE ]
  13. then
  14. echo "$PIDFILE does not exist, process is not running"
  15. else
  16. PID=$(cat $PIDFILE)
  17. echo "Stopping ..."
  18. $CLIEXEC -p $REDISPORT shutdown
  19. while [ -x /proc/${PID} ]
  20. do
  21. echo "Waiting for Redis to shutdown ..."
  22. sleep 1
  23. done
  24. echo "Redis stopped"
  25. fi
  26. ;;
  27. *)
  28. echo "Please use start or stop as first argument"
  29. ;;
  30. esac