Lines 3-8
Link Here
|
3 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# Distributed under the terms of the GNU General Public License v2 |
4 |
# $Header: /var/cvsroot/gentoo-x86/games-server/halflife-steam/files/hlds.rc,v 1.1 2005/11/16 03:24:56 vapier Exp $ |
4 |
# $Header: /var/cvsroot/gentoo-x86/games-server/halflife-steam/files/hlds.rc,v 1.1 2005/11/16 03:24:56 vapier Exp $ |
5 |
|
5 |
|
|
|
6 |
PID_PATH="/var/run" |
7 |
|
6 |
depend() { |
8 |
depend() { |
7 |
use net |
9 |
use net |
8 |
} |
10 |
} |
Lines 18-38
Link Here
|
18 |
return 0 |
20 |
return 0 |
19 |
} |
21 |
} |
20 |
|
22 |
|
21 |
start() { |
23 |
start_server() { |
22 |
checkconfig || return $? |
24 |
local serv_num=$1 |
|
|
25 |
local serv_opts="`eval echo '$'HLDS_SERVER${serv_num}`" |
26 |
local PID1=${PID_PATH}/hlds${serv_num}_1.pid |
27 |
local PID2=${PID_PATH}/hlds${serv_num}_2.pid |
28 |
rm -f $PID1 $PID2 |
23 |
|
29 |
|
24 |
ebegin "Starting Halflife Dedicated Server" |
30 |
test $serv_num != 1 -a -z "$serv_opts" && return 1 |
25 |
export LD_LIBRARY_PATH=${HLDS_PATH}:${HLDS_PATH}/bin:${LD_LIBRARY_PATH} |
31 |
|
|
|
32 |
ebegin "Starting Halflife Dedicated Server $serv_num" |
33 |
touch ${PID2} |
34 |
chown games:games ${PID2} |
26 |
start-stop-daemon --start \ |
35 |
start-stop-daemon --start \ |
27 |
--chdir ${HLDS_PATH} -c @GAMES_USER@:@GAMES_GROUP@ \ |
36 |
--chdir ${HLDS_PATH} -c games:games \ |
28 |
-n ${HLDS_MT} -b -a ${HLDS_PATH}/${HLDS_MT} \ |
37 |
-n ${HLDS_MT} -b -a ${HLDS_PATH}/${HLDS_MT} \ |
|
|
38 |
-m --pidfile ${PID1} \ |
29 |
-- \ |
39 |
-- \ |
30 |
-pidfile /var/run/hlds.pid ${HLDS_OPTS} |
40 |
-pidfile ${PID2} ${HLDS_OPTS} ${serv_opts} |
31 |
eend $? |
41 |
eend $? |
32 |
} |
42 |
} |
33 |
|
43 |
|
|
|
44 |
stop_server() { |
45 |
local serv_num=$1 |
46 |
local PID1=${PID_PATH}/hlds${serv_num}_1.pid |
47 |
local PID2=${PID_PATH}/hlds${serv_num}_2.pid |
48 |
if test -f ${PID1} -a -f ${PID2}; then |
49 |
ebegin "Stopping Halflife Dedicated Server $serv_num" |
50 |
start-stop-daemon --stop --pidfile ${PID1} |
51 |
start-stop-daemon --stop --pidfile ${PID2} |
52 |
eend $? |
53 |
rm -f $PID1 $PID2 |
54 |
else |
55 |
return 1 |
56 |
fi |
57 |
return 0 |
58 |
} |
59 |
|
60 |
start() { |
61 |
checkconfig || return $? |
62 |
|
63 |
# ebegin "Starting Halflife Dedicated Server" |
64 |
export LD_LIBRARY_PATH=${HLDS_PATH}:${HLDS_PATH}/bin:${LD_LIBRARY_PATH} |
65 |
local i=1 |
66 |
while start_server $i; do |
67 |
i=$(($i+1)) |
68 |
done |
69 |
} |
70 |
|
34 |
stop() { |
71 |
stop() { |
35 |
ebegin "Stopping Halflife Dedicated Server" |
72 |
local i=1 |
36 |
start-stop-daemon --stop --pidfile /var/run/hlds.pid |
73 |
while stop_server $i; do |
37 |
eend $? |
74 |
i=$(($i+1)) |
|
|
75 |
done |
38 |
} |
76 |
} |