3
# Provides: wesnoth-1.10-server
4
# Required-Start: $remote_fs
5
# Required-Stop: $remote_fs
7
# Default-Stop: 0 1 2 3 4 5 6
8
# Short-Description: Starts Wesnoth server (1.10)
9
# Description: Starts the Wesnoth server (1.10) used for multiplayer games.
12
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
13
DAEMON=/usr/games/wesnothd-1.10
15
NAME=wesnoth-1.10-server
16
DESC="Wesnoth server (1.10)"
17
PIDFILE=/var/run/$NAME.pid
19
test -x $DAEMON || exit 5
21
. /lib/lsb/init-functions
23
# Include wesnothd defaults if available
24
if [ -f /etc/default/$NAME ] ; then
31
start-stop-daemon --start --quiet --pidfile $PIDFILE --oknodo \
32
--background --exec $DAEMON --make-pidfile --chuid nobody \
33
-- $DAEMON_OPTS > /dev/null 2> /dev/null || return 1
38
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
39
--oknodo --exec $DAEMON || return 1
45
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE
50
log_daemon_msg "Starting $DESC" "$NAME"
55
log_daemon_msg "Stopping $DESC" "$NAME"
60
log_daemon_msg "Reloading $DESC" "$NAME"
66
log_daemon_msg "Restarting $DESC" "$NAME"
67
wesnoth_stop && sleep 1 && wesnoth_start
71
if [ -s "$PIDFILE" ]; then
72
if kill -0 `cat $PIDFILE` 2> /dev/null; then
73
log_success_msg "Wesnoth server is running"
76
log_failure_msg "$PIDFILE exists but Wesnoth server is not running"
80
log_success_msg "Wesnoth server is not running."
85
log_success_msg "Usage: $0 {start|stop|status|restart|force-reload}" >&2