3
# Provides: pyscrabble-server
4
# Required-Start: $local_fs $remote_fs
5
# Required-Stop: $local_fs $remote_fs
6
# Default-Start: 2 3 4 5
8
# Short-Description: PyScrabble server
9
# Description: Controls the PyScrabble server
14
PATH=/sbin:/bin:/usr/bin
15
DESC="PyScrabble server"
17
NAME2=pyscrabble-server
18
DAEMON=/usr/sbin/pyscrabble-server
19
PIDFILE=/var/run/$NAME2.pid
20
SCRIPTNAME=/etc/init.d/$NAME2
22
# Gracefully exit if the package has been removed.
23
test -x $DAEMON || exit 0
25
. /lib/lsb/init-functions
29
# Read config file if it is present.
30
if [ -r /etc/default/$NAME2 ]; then
35
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
36
--name $NAME --test > /dev/null
40
# Function that starts the daemon/service.
43
start-stop-daemon --start --oknodo --quiet --pidfile $PIDFILE --name $NAME \
44
--background --make-pidfile --chuid "$USER" --startas $DAEMON
48
# Function that stops the daemon/service.
51
start-stop-daemon --stop --oknodo --quiet --pidfile $PIDFILE --name $NAME
57
log_daemon_msg "Starting $DESC" "$NAME2"
59
log_progress_msg "already running"
66
log_daemon_msg "Stopping $DESC" "$NAME2"
68
log_progress_msg "not running"
76
# If the daemon can reload its configuration without
77
# restarting (for example, when it is sent a SIGHUP),
78
# then implement that here.
80
# If the daemon responds to changes in its config file
81
# directly anyway, make this an "exit 0".
83
# echo -n "Reloading $DESC configuration..."
89
# If the "reload" option is implemented, move the "force-reload"
90
# option to the "reload" entry above. If not, "force-reload" is
91
# just the same as "restart".
93
log_daemon_msg "Restarting $DESC" "$NAME2"
95
# One second might not be time enough for a daemon to stop,
96
# if this happens, d_start will fail (and dpkg will break if
97
# the package is being upgraded). Change the timeout if needed
98
# be, or change d_stop to have start-stop-daemon use --retry.
99
# Notice that using --retry slows down the shutdown process somewhat.
105
d_running || status="not "
106
log_action_msg "Status of $DESC:" "${status}running"
109
# echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
110
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2