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
10 # Short-Description: memcached - Memory caching daemon
11 # Description: memcached - Memory caching daemon
15 # cp /etc/memcached.conf /etc/memcached_server1.conf
16 # cp /etc/memcached.conf /etc/memcached_server2.conf
17 # start all instances:
18 # /etc/init.d/memcached start
20 # /etc/init.d/memcached start server1
22 # /etc/init.d/memcached stop
24 # /etc/init.d/memcached stop server1
25 # There is no "status" command.
27 PATH
=/usr
/local
/sbin
:/usr
/local
/bin
:/sbin
:/bin
:/usr
/sbin
:/usr
/bin
28 DAEMON
=/usr
/bin
/memcached
30 DAEMONBOOTSTRAP
=/usr
/share
/memcached
/scripts
/start-memcached
33 test -x $DAEMON ||
exit 0
34 test -x $DAEMONBOOTSTRAP ||
exit 0
38 FILES
=(/etc
/memcached_
*.conf
)
39 # check for alternative config schema
40 if [ -r "${FILES[0]}" ]; then
42 for FILE
in "${FILES[@]}";
49 # check optional second param
54 elif [ "memcached_$2" == "$NAME" ];
56 # use only one memcached
62 if [ ${#CONFIGS[@]} == 0 ];
64 echo "Config not exist for: $2" >&2
71 CONFIG_NUM
=${#CONFIGS[@]}
72 for ((i
=0; i
< $CONFIG_NUM; i
++)); do
74 PIDFILE
="/var/run/${NAME}.pid"
78 echo -n "Starting $DESC: "
79 start-stop-daemon
--start --quiet --exec "$DAEMONBOOTSTRAP" -- /etc
/${NAME}.conf
$PIDFILE
83 echo -n "Stopping $DESC: "
84 start-stop-daemon
--stop --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON
91 # If the "reload" option is implemented, move the "force-reload"
92 # option to the "reload" entry above. If not, "force-reload" is
93 # just the same as "restart".
95 echo -n "Restarting $DESC: "
96 start-stop-daemon
--stop --quiet --oknodo --pidfile $PIDFILE
99 start-stop-daemon
--start --quiet --exec "$DAEMONBOOTSTRAP" -- /etc
/${NAME}.conf
$PIDFILE
104 # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
105 echo "Usage: $N {start|stop|restart|force-reload}" >&2