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 13PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 14DAEMON=/usr/bin/memcached 15DAEMONBOOTSTRAP=/usr/share/memcached/scripts/start-memcached 16NAME=memcached 17DESC=memcached 18PIDFILE=/var/run/$NAME.pid 19 20test -x $DAEMON || exit 0 21test -x $DAEMONBOOTSTRAP || exit 0 22 23set -e 24 25case "$1" in 26 start) 27 echo -n "Starting $DESC: " 28 start-stop-daemon --start --quiet --exec $DAEMONBOOTSTRAP 29 echo "$NAME." 30 ;; 31 stop) 32 echo -n "Stopping $DESC: " 33 start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON 34 echo "$NAME." 35 rm -f $PIDFILE 36 ;; 37 38 restart|force-reload) 39 # 40 # If the "reload" option is implemented, move the "force-reload" 41 # option to the "reload" entry above. If not, "force-reload" is 42 # just the same as "restart". 43 # 44 echo -n "Restarting $DESC: " 45 start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE 46 rm -f $PIDFILE 47 sleep 1 48 start-stop-daemon --start --quiet --exec $DAEMONBOOTSTRAP 49 echo "$NAME." 50 ;; 51 *) 52 N=/etc/init.d/$NAME 53 # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 54 echo "Usage: $N {start|stop|restart|force-reload}" >&2 55 exit 1 56 ;; 57esac 58 59exit 0 60