4
# Required-Start: $network $remote_fs $local_fs
5
# Required-Stop: $network $remote_fs $local_fs
6
# Default-Start: 2 3 4 5
8
# Short-Description: memcached compatible KVS with master/slave replication
9
# Description: yrmcds is a memory object caching system with master/slave
10
# replication. Since its protocol is perfectly compatible
11
# with that of memcached, yrmcds can be used as a drop-in
12
# replacement for memcached.
15
# Author: Kouhei Maeda <mkouhei@palmtb.net>
17
# PATH should only include /usr/* if it runs after the mountnfs.sh script
18
PATH=/sbin:/usr/sbin:/bin:/usr/bin
19
DESC=yrmcds # Introduce a short description here
20
NAME=yrmcds # Introduce the short server's name here
22
DAEMON=/usr/sbin/yrmcdsd # Introduce the server's location here
23
DAEMON_ARGS="" # Arguments to run the daemon with
24
PIDFILE=/var/run/$NAME.pid
25
SCRIPTNAME=/etc/init.d/$NAME
29
# Exit if the package is not installed
30
[ -x $DAEMON ] || exit 0
32
# Read configuration variable file if it is present
33
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
35
# Load the VERBOSE setting and other rcS variables
39
# Define LSB log_* functions.
40
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
41
. /lib/lsb/init-functions
43
test -z $NOFILE_LIMIT || ulimit -n $NOFILE_LIMIT
47
test -d /var/tmp/yrmcds || install -o $USER -g $GROUP -m 0700 -d /var/tmp/yrmcds
48
rm -f /var/tmp/yrmcds/*
52
if init_is_upstart; then
58
# Function that starts the daemon/service
64
# 0 if daemon has been started
65
# 1 if daemon was already running
66
# 2 if daemon could not be started
67
start-stop-daemon --start --quiet --pidfile $PIDFILE -m -u $USER -g $GROUP -b --exec $DAEMON --test > /dev/null \
69
start-stop-daemon --start --quiet --pidfile $PIDFILE -m -u $USER -g $GROUP -b --exec $DAEMON -- \
72
# The above code will not work for interpreted scripts, use the next
73
# six lines below instead (Ref: #643337, start-stop-daemon(8) )
74
#start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON \
75
# --name $NAME --test > /dev/null \
77
#start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON \
78
# --name $NAME -- $DAEMON_ARGS \
81
# Add code here, if necessary, that waits for the process to be ready
82
# to handle requests from services started subsequently which depend
83
# on this one. As a last resort, sleep for some time.
87
# Function that stops the daemon/service
92
# 0 if daemon has been stopped
93
# 1 if daemon was already stopped
94
# 2 if daemon could not be stopped
95
# other if a failure occurred
96
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $DAEMON_NAME
98
[ "$RETVAL" = 2 ] && return 2
99
# Wait for children to finish too if this is a daemon that forks
100
# and if the daemon is only ever run from this initscript.
101
# If the above conditions are not satisfied then add some other code
102
# that waits for the process to drop all resources that could be
103
# needed by services started subsequently. A last resort is to
104
# sleep for some time.
105
#start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
106
[ "$?" = 2 ] && return 2
107
# Many daemons don't delete their pidfiles when they exit.
113
# Function that sends a SIGHUP to the daemon/service
117
# If the daemon can reload its configuration without
118
# restarting (for example, when it is sent a SIGHUP),
119
# then implement that here.
121
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $DAEMON_NAME
128
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME"
131
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
132
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
137
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
140
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
141
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
146
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
150
# If do_reload() is not implemented then leave this commented out
151
# and leave 'force-reload' as an alias for 'restart'.
153
log_daemon_msg "Reloading $DESC" "$NAME"
157
restart|force-reload)
160
# If the "reload" option is implemented then remove the
161
# 'force-reload' alias
163
log_daemon_msg "Restarting $DESC" "$NAME"
170
1) log_end_msg 1 ;; # Old process is still running
171
*) log_end_msg 1 ;; # Failed to start
181
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
182
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2