summaryrefslogtreecommitdiff
blob: a19d6c682ec3ab0d5abe5f8686deca18e39d2ba2 (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 Foundation
# Distributed under the terms of the GNU General Public License v2

depend() {
        need net
}

start() {
        ebegin "Starting Americas Army dedicated server"
        screen -A -m -d -S armyops-ded su - games -c "/usr/games/bin/armyops-ded ${aa_OPTS}"
        eend $?
}

stop() {
        ebegin "Stopping Americas Army dedicated server"
        local pid=`screen -list | grep armyops-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:^.*server-bin::'`
		pid=${pid:1:${#pid}-2}
                if [ -z "${pid}" ] ; then
                        eend 1 "Lost armyops-ded session"
                else
                        kill ${pid}
                        eend $? "Could not kill armyops-ded"
                fi
        fi
}

status() {
        screen -list | grep armyops-ded
}