summaryrefslogtreecommitdiff
blob: fe84dd95af299d498fe93c7bcc8da15004d40b30 (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
#!/sbin/runscript
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-server/halflife-dpb/files/hlds-dpb.rc,v 1.1 2003/09/10 05:51:11 vapier Exp $

depend() {
	need net
}

start() {
	ebegin "Starting halflife dpb dedicated"
	screen -A -m -d -S hlds-dpb su - GENTOO_GAMES_USER -c "GENTOO_DIR/hlds-dpb ${HLDS_OPTS}" &
	eend $?
}

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