summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'games-strategy/netpanzer/files/netpanzer.rc')
-rw-r--r--games-strategy/netpanzer/files/netpanzer.rc34
1 files changed, 34 insertions, 0 deletions
diff --git a/games-strategy/netpanzer/files/netpanzer.rc b/games-strategy/netpanzer/files/netpanzer.rc
new file mode 100644
index 00000000000..87ff15f9953
--- /dev/null
+++ b/games-strategy/netpanzer/files/netpanzer.rc
@@ -0,0 +1,34 @@
+#!/sbin/runscript
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+depend() {
+ need net
+}
+
+start() {
+ ebegin "Starting netpanzer dedicated server"
+ screen -A -m -d -S netpanzer-ded su - GAMES_USER_DED -c "GENTOO_DIR/netpanzer-ded"
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping netpanzer dedicated server"
+ local pid=`screen -list | grep netpanzer-ded | awk -F . '{print $1}' | sed -e s/.//`
+ if [[ -z "${pid}" ]] ; then
+ eend 1 "Lost screen session"
+ else
+ pid=`pstree -p ${pid} | sed -e 's:^.*netpanzer-ded(\([0-9]*\)).*:\1:'`
+ if [[ -z "${pid}" ]] ; then
+ eend 1 "Lost netpanzer-ded session"
+ else
+ kill ${pid}
+ eend $? "Could not kill netpanzer-ded"
+ fi
+ fi
+}
+
+status() {
+ screen -list | grep netpanzer-ded
+}