-
Notifications
You must be signed in to change notification settings - Fork 4
/
run_srcds_server
executable file
·37 lines (27 loc) · 1.34 KB
/
run_srcds_server
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
#!/bin/bash
cd ${APPDIR}
SERVER_CONFIG_FILE=${APPDIR}/${APP_GAME_NAME}/cfg/server.cfg
if ! [ -f ${APPDIR}/${APP_GAME_NAME}/cfg/server.cfg ]; then
if [ -f /tmp/server.cfg ]; then
echo "Applying server configuration"
cp /tmp/server.cfg ${SERVER_CONFIG_FILE}
sed -i "s/^hostname.*/hostname \"${APP_SERVER_NAME}\"/" ${SERVER_CONFIG_FILE}
sed -i "s/^sv_contact.*/sv_contact \"${APP_SERVER_CONTACT}\"/" ${SERVER_CONFIG_FILE}
sed -i "s/^sv_region.*/sv_region \"${APP_SERVER_REGION}\"/" ${SERVER_CONFIG_FILE}
sed -i "s/^rcon_password.*/rcon_password \"${APP_RCON_PASSWORD}\"/" ${SERVER_CONFIG_FILE}
fi
fi
if ! [ "x${APP_SERVER_TOKEN}" = "x" ]; then
echo "sv_setsteamaccount ${APP_SERVER_TOKEN}" > ${APPDIR}/${APP_GAME_NAME}/cfg/autoexec_steamaccount.cfg
STEAM_SERVER_TOKEN="+exec autoexec_steamaccount.cfg"
fi
if [ "$USE_SRCDS" = "true" ]; then
if ! [ "x${APP_GAME_NAME}" = "x" ]; then
APP_GAME_NAME="-game ${APP_GAME_NAME}"
fi
echo "running: ./srcds_run -console ${APP_GAME_NAME} ${APP_SRCDS_FLAGS} -nohltv ${STEAM_SERVER_TOKEN} +maxplayers ${APP_SERVER_MAXPLAYERS} +map ${APP_SERVER_MAP} -port ${APP_SERVER_PORT}"
./srcds_run -console ${APP_GAME_NAME} ${APP_SRCDS_FLAGS} -nohltv ${STEAM_SERVER_TOKEN} +maxplayers ${APP_SERVER_MAXPLAYERS} +map ${APP_SERVER_MAP} -port ${APP_SERVER_PORT}
else
echo "Unknown Server Startup Usage"
exit 1
fi