Debian Codegraph @

debian/openarena-server.init

raw
1 #! /bin/sh
2 ### BEGIN INIT INFO
3 # Provides: openarena-server
4 # Required-Start: $remote_fs $network
5 # Required-Stop: $remote_fs $network
6 # Default-Start: 2 3 4 5
7 # Default-Stop: 0 1 6
8 # Short-Description: Start OpenArena game server
9 # Description: Dedicated server for OpenArena, a fast-paced 3D
10 # first-person shooter game similar to Quake III Arena
11 ### END INIT INFO
12
13 PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
14 NAME="openarena-server"
15 DAEMON="/usr/games/$NAME"
16 DESC="OpenArena dedicated server"
17 PIDFILE="/var/run/$NAME.pid"
18 BINARY="/usr/lib/ioquake3/ioq3ded"
19 USER="Debian-openarena"
20
21 test -x $DAEMON || exit 0
22
23 . /lib/lsb/init-functions
24
25 # Include defaults if available
26 if [ -f /etc/default/$NAME ] ; then
27 . /etc/default/$NAME
28 fi
29
30 q3_start() {
31 start-stop-daemon --start --quiet --pidfile $PIDFILE --oknodo \
32 --background --exec $BINARY --startas $DAEMON \
33 --make-pidfile --chuid $USER \
34 --\
35 +set fs_homepath /var/games/openarena-server/server.oa $DAEMON_OPTS\
36 +exec etc/openarena-server/server.cfg > /dev/null 2>&1 || return 1
37 return 0
38 }
39
40 q3_stop() {
41 start-stop-daemon --stop --quiet --pidfile $PIDFILE \
42 --oknodo --exec $BINARY || return 1
43 rm -f $PIDFILE
44 return 0
45 }
46
47 case "$1" in
48 start)
49 log_begin_msg "Starting $DESC: $NAME"
50 q3_start
51 log_end_msg $?
52 ;;
53 stop)
54 log_begin_msg "Stopping $DESC: $NAME"
55 q3_stop
56 log_end_msg $?
57 ;;
58 #reload)
59 #
60 # If the daemon can reload its config files on the fly
61 # for example by sending it SIGHUP, do it here.
62 #
63 # If the daemon responds to changes in its config file
64 # directly anyway, make this a do-nothing entry.
65 #
66 # echo "Reloading $DESC configuration files."
67 # start-stop-daemon --stop --signal 1 --quiet --pidfile \
68 # /var/run/$NAME.pid --exec $DAEMON
69 #;;
70 restart|force-reload)
71 #
72 # If the "reload" option is implemented, move the "force-reload"
73 # option to the "reload" entry above. If not, "force-reload" is
74 # just the same as "restart".
75 #
76 log_begin_msg "Restarting $DESC: $NAME"
77 q3_stop && sleep 1 && q3_start
78 log_end_msg $?
79 ;;
80 status)
81 status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $?
82 ;;
83 *)
84 # echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
85 echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
86 exit 1
87 ;;
88 esac
89
90 exit 0