Guest User

Untitled

a guest
Nov 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # redis - this script starts and stops the redis-server daemon
  4. #
  5. # chkconfig: - 85 15
  6. # description: Redis is a persistent key-value database
  7. # processname: redis-server
  8. # config: /home/capistrano/path/to/app/config/redis/production.conf
  9. # config: /etc/sysconfig/redis
  10. # pidfile: /var/run/redis.pid
  11.  
  12. # Source function library.
  13. . /etc/rc.d/init.d/functions
  14.  
  15. # Source networking configuration.
  16. . /etc/sysconfig/network
  17.  
  18. # Check that networking is up.
  19. [ "$NETWORKING" = "no" ] && exit 0
  20.  
  21. redis="/usr/local/sbin/redis-server"
  22. prog=$(basename $redis)
  23.  
  24. REDIS_CONF_FILE="/home/capistrano/path/to/app/config/redis/production.conf"
  25.  
  26. [ -f /etc/sysconfig/redis ] && . /etc/sysconfig/redis
  27.  
  28. lockfile=/var/lock/subsys/redis
  29.  
  30. start() {
  31. [ -x $redis ] || exit 5
  32. [ -f $REDIS_CONF_FILE ] || exit 6
  33. echo -n $"Starting $prog: "
  34. daemon $redis $REDIS_CONF_FILE
  35. retval=$?
  36. echo
  37. [ $retval -eq 0 ] && touch $lockfile
  38. return $retval
  39. }
  40.  
  41. stop() {
  42. echo -n $"Stopping $prog: "
  43. killproc $prog -QUIT
  44. retval=$?
  45. echo
  46. [ $retval -eq 0 ] && rm -f $lockfile
  47. return $retval
  48. }
  49.  
  50. restart() {
  51. stop
  52. sleep 1
  53. start
  54. }
  55.  
  56. reload() {
  57. echo -n $"Reloading $prog: "
  58. killproc $redis -HUP
  59. RETVAL=$?
  60. echo
  61. }
  62.  
  63. force_reload() {
  64. restart
  65. }
  66.  
  67. rh_status() {
  68. status $prog
  69. }
Add Comment
Please, Sign In to add comment