1#! /bin/sh 2# 3# skeleton example file to build /etc/init.d/ scripts. 4# This file should be used to construct scripts for /etc/init.d. 5# 6# Written by Miquel van Smoorenburg <[email protected]>. 7# Modified for Debian 8# by Ian Murdock <[email protected]>. 9# 10# Version: @(#)skeleton 1.9 26-Feb-2001 [email protected] 11# 12### BEGIN INIT INFO 13# Provides: memcached 14# Required-Start: $syslog 15# Required-Stop: $syslog 16# Default-Start: 2 3 4 5 17# Default-Stop: 0 1 6 18# Short-Description: Start memcached daemon at boot time 19# Description: Enable memcached server 20### END INIT INFO 21 22 23PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 24DAEMON=/usr/bin/memcached 25DAEMONBOOTSTRAP=/usr/share/memcached/scripts/start-memcached 26NAME=memcached 27DESC=memcached 28PIDFILE=/var/run/$NAME.pid 29 30test -x $DAEMON || exit 0 31test -x $DAEMONBOOTSTRAP || exit 0 32 33set -e 34 35case "$1" in 36 start) 37 echo -n "Starting $DESC: " 38 start-stop-daemon --start --quiet --exec $DAEMONBOOTSTRAP 39 echo "$NAME." 40 ;; 41 stop) 42 echo -n "Stopping $DESC: " 43 start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON 44 echo "$NAME." 45 rm -f $PIDFILE 46 ;; 47 48 restart|force-reload) 49 # 50 # If the "reload" option is implemented, move the "force-reload" 51 # option to the "reload" entry above. If not, "force-reload" is 52 # just the same as "restart". 53 # 54 echo -n "Restarting $DESC: " 55 start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE 56 rm -f $PIDFILE 57 sleep 1 58 start-stop-daemon --start --quiet --exec $DAEMONBOOTSTRAP 59 echo "$NAME." 60 ;; 61 *) 62 N=/etc/init.d/$NAME 63 # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 64 echo "Usage: $N {start|stop|restart|force-reload}" >&2 65 exit 1 66 ;; 67esac 68 69exit 0 70