Guest User

Untitled

a guest
Jan 23rd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # redis this script starts and stops the redis daemon
  4. #
  5. # chkconfig: - 85 15
  6.  
  7. REDISPORT=6379
  8. EXEC=/usr/local/bin/redis-server
  9.  
  10. PIDFILE=/var/run/redis.pid
  11. CONF="/etc/redis.conf"
  12.  
  13. case "$1" in
  14. start)
  15. if [ -f $PIDFILE ]
  16. then
  17. echo -n "$PIDFILE exists, process is already running or crashed\n"
  18. else
  19. echo -n "Starting Redis server...\n"
  20. $EXEC $CONF
  21. fi
  22. ;;
  23. stop)
  24. if [ ! -f $PIDFILE ]
  25. then
  26. echo -n "$PIDFILE does not exist, process is not running\n"
  27. else
  28. PID=$(cat $PIDFILE)
  29. echo -n "Stopping ...\n"
  30. echo -n "SHUTDOWN\r\n" | nc localhost $REDISPORT &
  31. while [ -x /proc/${PIDFILE} ]
  32. do
  33. echo "Waiting for Redis to shutdown ..."
  34. sleep 1
  35. done
  36. echo "Redis stopped"
  37. fi
  38. ;;
  39. esac
Add Comment
Please, Sign In to add comment