Advertisement
Guest User

Memcache init.d script

a guest
Oct 27th, 2011
668
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.72 KB | None | 0 0
  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:     memcached
  4. # Required-Start:   $syslog
  5. # Required-Stop:    $syslog
  6. # Should-Start:     $local_fs
  7. # Should-Stop:      $local_fs
  8. # Default-Start:    2 3 4 5
  9. # Default-Stop:     0 1 6
  10. # Short-Description:    memcached - Memory caching daemon
  11. # Description:      memcached - Memory caching daemon
  12. ### END INIT INFO
  13.  
  14.  
  15. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  16. DAEMON=/usr/bin/memcached
  17. DAEMONBOOTSTRAP=/usr/share/memcached/scripts/start-memcached
  18. NAME=memcached
  19. DESC=memcached
  20. PIDFILE=/var/run/$NAME.pid
  21.  
  22. test -x $DAEMON || exit 0
  23. test -x $DAEMONBOOTSTRAP || exit 0
  24.  
  25. set -e
  26.  
  27. . /lib/lsb/init-functions
  28.  
  29. # Edit /etc/default/memcached to change this.
  30. ENABLE_MEMCACHED=no
  31. test -r /etc/default/memcached && . /etc/default/memcached
  32.  
  33. case "$1" in
  34.   start)
  35.     echo -n "Starting $DESC: "
  36.   if [ $ENABLE_MEMCACHED = yes ]; then
  37.     start-stop-daemon --start --quiet --exec $DAEMONBOOTSTRAP
  38.     echo "$NAME."
  39.     else
  40.         echo "$NAME disabled in /etc/default/memcached."
  41.     fi
  42.     ;;
  43.   stop)
  44.     echo -n "Stopping $DESC: "
  45.     start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON
  46.     echo "$NAME."
  47.     rm -f $PIDFILE
  48.     ;;
  49.  
  50.   restart|force-reload)
  51.     #
  52.     #   If the "reload" option is implemented, move the "force-reload"
  53.     #   option to the "reload" entry above. If not, "force-reload" is
  54.     #   just the same as "restart".
  55.     #
  56.     echo -n "Restarting $DESC: "
  57.     start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
  58.     rm -f $PIDFILE
  59.     sleep 1
  60.     start-stop-daemon --start --quiet --exec $DAEMONBOOTSTRAP
  61.     echo "$NAME."
  62.     ;;
  63.   status)
  64.     status_of_proc $DAEMON $NAME
  65.     ;;
  66.   *)
  67.     N=/etc/init.d/$NAME
  68.     echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
  69.     exit 1
  70.     ;;
  71. esac
  72.  
  73. exit 0
  74.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement