Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # redis Startup script for Redis Server
  4. #
  5. # chkconfig: - 90 10
  6. # description: Redis is an open source, advanced key-value store.
  7. #
  8. # processname: redis-server
  9. # config: /etc/redis.conf
  10. # pidfile: /var/run/redis.pid
  11.  
  12. PATH=/usr/local/bin:/sbin:/usr/bin:/bin
  13.  
  14. REDISPORT=6379
  15. EXEC=/opt/redis/redis-server
  16. REDIS_CLI=/opt/redis/redis-cli
  17.  
  18. PIDFILE=/var/run/redis.pid
  19. CONF="/opt/redis/redis.conf"
  20.  
  21. case "$1" in
  22. start)
  23. if [ -f $PIDFILE ]
  24. then
  25. echo -n "$PIDFILE exists, process is already running or crashed\n"
  26. else
  27. echo -n "Starting Redis server...\n"
  28. $EXEC $CONF
  29. fi
  30. ;;
  31. stop)
  32. if [ ! -f $PIDFILE ]
  33. then
  34. echo -n "$PIDFILE does not exist, process is not running\n"
  35. else
  36. PID=$(cat $PIDFILE)
  37. echo -n "Stopping ...\n"
  38. $REDIS_CLI -p $REDISPORT SHUTDOWN
  39. while [ -x ${PIDFILE} ]
  40. do
  41. echo "Waiting for Redis to shutdown ..."
  42. sleep 1
  43. done
  44. echo "Redis stopped"
  45. fi
  46. ;;
  47. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement