22 |
CRASH_DEBUG_MSG="email debug.log to linux@valvesoftware.com" |
CRASH_DEBUG_MSG="email debug.log to linux@valvesoftware.com" |
23 |
GDB="gdb" # the gdb binary to run |
GDB="gdb" # the gdb binary to run |
24 |
DEBUG_LOG="debug.log" |
DEBUG_LOG="debug.log" |
25 |
PID_FILE="" # only needed it DEBUG is set so init later |
PID_FILE="" # Used for debug and with -pidfile argument |
26 |
STEAM="" |
STEAM="" |
27 |
PID_FILE_SET=0 |
#PID_FILE_SET=0 |
28 |
STEAMERR="" |
STEAMERR="" |
29 |
SIGINT_ACTION="quit 0" # exit normally on sig int |
SIGINT_ACTION="quit 0" # exit normally on sig int |
30 |
NO_TRAP=0 |
NO_TRAP=0 |
31 |
AUTO_UPDATE="" |
AUTO_UPDATE="" |
32 |
STEAM_USER="" |
#STEAM_USER="" |
33 |
STEAM_PASSWORD="" |
#STEAM_PASSWORD="" |
34 |
|
BETA_VERSION="" |
35 |
PARAMS=$* |
PARAMS=$* |
36 |
|
|
37 |
# Remove any old default pid files |
# Remove any old default pid files |
51 |
GAME="$2" |
GAME="$2" |
52 |
shift ;; |
shift ;; |
53 |
"-debug") |
"-debug") |
54 |
DEBUG=1 |
DEBUG=1 ;; |
55 |
# Ensure that PID_FILE is set |
# Ensure that PID_FILE is set |
56 |
PID_FILE_SET=1 |
#PID_FILE_SET=1 |
57 |
if test -z "$PID_FILE"; then |
#if test -z "$PID_FILE"; then |
58 |
PID_FILE="hlds.$$.pid" |
# PID_FILE="hlds.$$.pid" |
59 |
fi ;; |
#fi ;; |
60 |
"-norestart") |
"-norestart") |
61 |
RESTART="" ;; |
RESTART="" ;; |
62 |
"-pidfile") |
"-pidfile") |
63 |
PID_FILE="$2" |
PID_FILE="$2" |
64 |
PID_FILE_SET=1 |
#PID_FILE_SET=1 |
65 |
shift ;; |
shift ;; |
66 |
"-binary") |
"-binary") |
67 |
HL="$2" |
HL="$2" |
86 |
SIGINT_ACTION="" ;; |
SIGINT_ACTION="" ;; |
87 |
"-notrap") |
"-notrap") |
88 |
NO_TRAP=1 ;; |
NO_TRAP=1 ;; |
89 |
"-steamuser") |
#"-steamuser") |
90 |
STEAM_USER="$2"; |
# STEAM_USER="$2"; |
91 |
shift ;; |
# shift ;; |
92 |
"-steampass") |
#"-steampass") |
93 |
STEAM_PASSWORD="$2"; |
# STEAM_PASSWORD="$2"; |
94 |
|
# shift ;; |
95 |
|
"-beta") |
96 |
|
BETA_VERSION="$2"; |
97 |
shift ;; |
shift ;; |
98 |
"-help") |
"-help") |
99 |
# quit with syntax |
# quit with syntax |
139 |
if test -n "$DEBUG" ; then |
if test -n "$DEBUG" ; then |
140 |
#turn on core dumps :) (if possible) |
#turn on core dumps :) (if possible) |
141 |
echo "Enabling debug mode" |
echo "Enabling debug mode" |
142 |
if test "unlimited" != `ulimit -c` && test "`ulimit -c`" -eq 0 ; then |
if test "`ulimit -c`" -eq 0 ; then |
143 |
ulimit -c 2000 |
ulimit -c 2000 |
144 |
fi |
fi |
145 |
GDB_TEST=`$GDB -v` |
GDB_TEST=`$GDB -v` |
150 |
fi |
fi |
151 |
fi |
fi |
152 |
|
|
153 |
if test -n "$STEAM_PASSWORD" && test -z "$STEAM_USER"; then |
#if test -n "$STEAM_PASSWORD" && test -z "$STEAM_USER"; then |
154 |
echo "You must set both the steam username and password." |
# echo "You must set both the steam username and password." |
155 |
quit 1 |
# quit 1 |
156 |
|
#fi |
157 |
|
|
158 |
|
PID_PASSED="`echo \047$PARAMS\047 | grep -e -pidfile`"; |
159 |
|
if test -n "$PID_PASSED" || test -n "$DEBUG"; then |
160 |
|
if test -z "$PID_FILE"; then |
161 |
|
PID_FILE="hlds.$$.pid" |
162 |
|
fi |
163 |
fi |
fi |
164 |
|
|
165 |
if test 1 -eq $PID_FILE_SET && test -n "$PID_FILE"; then |
if test -n "$DEBUG" && test -z "$PID_PASSED"; then |
166 |
HL_CMD="$HL $PARAMS -pidfile $PID_FILE" |
HL_CMD="$HL $PARAMS -pidfile $PID_FILE" |
167 |
else |
else |
168 |
HL_CMD="$HL $PARAMS" |
HL_CMD="$HL $PARAMS" |
176 |
echo "$0 [-game <game>] [-debug] [-norestart] [-pidfile]" |
echo "$0 [-game <game>] [-debug] [-norestart] [-pidfile]" |
177 |
echo " [-binary [hlds_i486|hlds_i686|hlds_amd]" |
echo " [-binary [hlds_i486|hlds_i686|hlds_amd]" |
178 |
echo " [-timeout <number>] [-gdb <gdb>] [-autoupdate]" |
echo " [-timeout <number>] [-gdb <gdb>] [-autoupdate]" |
179 |
echo " [-steamerr] [-ignoresigint] [-steamuser <username>]" |
#echo " [-steamerr] [-ignoresigint] [-steamuser <username>]" |
180 |
echo " [-steampass <password>] [-debuglog <logname>]" |
echo " [-steamerr] [-ignoresigint] [-debuglog <logname>]" |
181 |
|
#echo " [-steampass <password>] [-debuglog <logname>]" |
182 |
|
echo " [-beta <version>]" |
183 |
echo "Params:" |
echo "Params:" |
184 |
echo "-game <game> Specifies the <game> to run." |
echo "-game <game> Specifies the <game> to run." |
185 |
echo "-debug Run debugging on failed servers if possible." |
echo "-debug Run debugging on failed servers if possible." |
191 |
echo " a failed server." |
echo " a failed server." |
192 |
echo "-gdb <gdb> Use <dbg> as the debugger of failed servers." |
echo "-gdb <gdb> Use <dbg> as the debugger of failed servers." |
193 |
echo "-steamerr Quit on steam update failure." |
echo "-steamerr Quit on steam update failure." |
194 |
echo "-steamuser <username> Use this username for steam updates." |
#echo "-steamuser <username> Use this username for steam updates." |
195 |
echo "-steampass <password> Use this password for steam updates" |
#echo "-steampass <password> Use this password for steam updates" |
196 |
echo " (-steamuser must be specified as well)." |
#echo " (-steamuser must be specified as well)." |
197 |
echo "-ignoresigint Ignore signal INT ( prevents CTRL+C quitting" |
echo "-ignoresigint Ignore signal INT ( prevents CTRL+C quitting" |
198 |
echo " the script )." |
echo " the script )." |
199 |
echo "-notrap Don't use trap. This prevents automatic" |
echo "-notrap Don't use trap. This prevents automatic" |
200 |
echo " removal of old lock files." |
echo " removal of old lock files." |
201 |
|
echo "-beta <version> Use the specified beta version for autoupdate." |
202 |
echo "" |
echo "" |
203 |
echo "Note: All parameters specified as passed through to the server" |
echo "Note: All parameters specified are passed through to the server" |
204 |
echo "including any not listed." |
echo "including any not listed." |
205 |
} |
} |
206 |
|
|
316 |
if test -f "$STEAM"; then |
if test -f "$STEAM"; then |
317 |
echo "Updating server using Steam." |
echo "Updating server using Steam." |
318 |
CMD="$STEAM -command update -game $GAME -dir ."; |
CMD="$STEAM -command update -game $GAME -dir ."; |
319 |
if test -n "$STEAM_USER"; then |
if test -n "$BETA_VERSION"; then |
320 |
CMD="$CMD -username $STEAM_USER"; |
CMD="$CMD -beta $BETA_VERSION"; |
|
fi |
|
|
if test -n "$STEAM_PASSWORD"; then |
|
|
CMD="$CMD -password $STEAM_PASSWORD"; |
|
321 |
fi |
fi |
322 |
|
#if test -n "$STEAM_USER"; then |
323 |
|
# CMD="$CMD -username $STEAM_USER"; |
324 |
|
#fi |
325 |
|
#if test -n "$STEAM_PASSWORD"; then |
326 |
|
# CMD="$CMD -password $STEAM_PASSWORD"; |
327 |
|
#fi |
328 |
|
|
329 |
$CMD |
$CMD |
330 |
if test $? -ne 0; then |
if test $? -ne 0; then |