summaryrefslogtreecommitdiff
blob: f4130820b071e1284004e9d0aeb740fe946b47ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-fps/quake3/files/q3ded.rc,v 1.6 2004/04/18 08:44:01 vapier Exp $

depend() {
	need net
}

start() {
	ebegin "Starting Quake3 dedicated server"
	screen -A -m -d -S q3ded su - games-ded -c "q3ded ${q3_OPTS}"
	eend $?
}

stop() {
	ebegin "Stopping Quake3 dedicated server"
	local pid=`screen -list | grep q3ded | awk -F . '{print $1}' | sed -e s/.//`
	if [ -z "${pid}" ] ; then
		eend 1 "Lost screen session"
	else
		pid=`pstree -p ${pid} | sed -e 's:^.*q3ded::'`
		pid=${pid:1:${#pid}-2}
		if [ -z "${pid}" ] ; then
			eend 1 "Lost q3ded session"
		else
			kill ${pid}
			eend $? "Could not kill q3ded"
		fi
	fi
}

status() {
	screen -list | grep q3ded
}