From 552a467b7d70c7f199e0e7c2b8fe7428c179c7a0 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Thu, 29 Aug 2013 23:22:46 +0100 Subject: [PATCH] added new function "details" * The details function displays all port and WebAdmin details. This function will be rolled out to all scripts in time. * Added optimisations and improvements to the installer. * Fixed some typos. * Added engine variable to help details and in future server query to know what type of server is running. --- UnrealTournament2004/ut2k4server | 98 ++++++++++++++++++++++++-------- 1 file changed, 74 insertions(+), 24 deletions(-) diff --git a/UnrealTournament2004/ut2k4server b/UnrealTournament2004/ut2k4server index 7116cc321..afcd3c29f 100644 --- a/UnrealTournament2004/ut2k4server +++ b/UnrealTournament2004/ut2k4server @@ -3,7 +3,7 @@ # Server Management Script # Author: Daniel Gibbs # Website: http://danielgibbs.co.uk -# Version: 280813 +# Version: 290813 #### Variables #### @@ -22,6 +22,7 @@ compressedmapsdir="${rootdir}/Maps-Compressed" # Server names servicename="ut2k4-server" gamename="Unreal Tournament 2004" +engine="unreal2" ini="${servicename}.ini" servername=`grep -s ServerName= ${systemdir}/${ini} | sed 's/ServerName=//g'` @@ -303,6 +304,64 @@ cd ${systemdir} mv -fv ${filesdir}/Maps/*.uz2 $compressedmapsdir } +fn_details(){ +echo "" +echo "${gamename} Server Details" +echo "============================" +echo "" +echo "${servername} Ports" +echo "=======================" +if [ "${engine}" = "unreal2" ];then + gameport=$(grep Port= ${systemdir}/${ini}|grep -v Master|grep -v LAN|grep -v Proxy|grep -v Listen|sed 's/\Port=//g') + queryport=$((${gameport} + 1)) + gsqueryport=$((${gameport} + 10)) + webadmin=$(grep ListenPort= ${systemdir}/${ini}|sed 's/\ListenPort=//g') + webadminuser=$(grep AdminName= ${systemdir}/${ini}|sed 's/\AdminName=//g') + webadminpass=$(grep AdminPassword= ${systemdir}/${ini}|sed 's/\AdminPassword=//g') + echo "Ports the server is currently using" + echo "" + echo "DIRECTION DESCRIPTION PORT" + echo "INBOUND Game Port ${gameport}" + echo "INBOUND Query Port ${queryport}" + echo "INBOUND GameSpy Query Port ${gsqueryport}" + echo "OUTBOUND Master Server port 28900/28902" + if [ "${appid}" ];then + echo "OUTBOUND Steam Port 20660" + fi + echo "INBOUND: WebAdmin ${webadmin}" + echo "" + echo "${servername} WebAdmin" + echo "=======================" + echo "WebAdmin URL: http://localhost:${webadmin}" + echo "WebAdmin Username: ${webadminuser}" + echo "WebAdmin Password: ${webadminpass}" + echo "" + echo "Config file" + echo "${systemdir}/${ini}" +elif [ "${engine}" = "source" ];then + servername=`grep -s hostname ${servercfg} | sed 's/hostname //g'|sed 's/"//g'` + rcon=`grep -s rcon_password ${servercfg} | sed 's/rcon_password //g'|sed 's/"//g'` + echo "Ports the server is currently using" + echo "" + echo "DIRECTION DESCRIPTION PORT" + echo "INBOUND Game/Rcon Port ${port}" + echo "INBOUND SourceTV Port ${sourcetvport}" + echo "OUTBOUND Client Port ${clientport}" + echo "" + echo "You can change ports by editing the" + echo "start parameters in ${selfname}" + echo "" + echo "${servername} Details" + echo "=======================" + echo "Server name: ${servername}" + echo "Rcon Password: ${rcon}" + echo "" + echo "Config file:" + echo "${servercfg}" +fi +echo "" +} + # ## Installer # @@ -419,7 +478,7 @@ echo "=================================" echo "Extracting dedicatedserver3339-bonuspack.zip" sleep 1 unzip dedicatedserver3339-bonuspack.zip - echo "Extracting dedicatedserver3339-bonuspack.zip" + echo "ut2004-lnxpatch3369-2.tar.bz2" sleep 1 tar -xvjf ut2004-lnxpatch3369-2.tar.bz2 UT2004-Patch/ --strip-components=1 cd ${systemdir} @@ -461,52 +520,41 @@ echo "=================================" echo -n "KEY: " read CODE echo ""\""CDKey"\""="\""${CODE}"\""" > ${systemdir}/cdkey > /dev/null 2>&1 -echo "" + fn_header echo "Configuring ${gamename} Server" echo "=================================" sleep 1 echo "Copying ${systemdir}/ut2004.ini to ${systemdir}/${ini}" cp ${systemdir}/UT2004.ini ${systemdir}/${ini} sleep 1 - echo "" echo "Creating log directory" mkdir -v ${logdir} sleep 1 - echo "" echo "Applying WebAdmin ut2003.css fix!" echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13" sed -i 's/none}/none;/g' ${filesdir}/Web/ServerAdmin/ut2003.css sed -i 's/underline}/underline;/g' ${filesdir}/Web/ServerAdmin/ut2003.css sleep 1 - echo "" echo "Setting WebAdmin username and password" sed -i 's/AdminName=/AdminName=admin/g' ${systemdir}/${ini} sed -i 's/AdminPassword=/AdminPassword=utpass/g' ${systemdir}/${ini} sleep 1 - echo "" echo "Enabling WebAdmin" sed -i 's/bEnabled=False/bEnabled=True/g' ${systemdir}/${ini} sleep 1 - echo "" echo "Setting WebAdmin port to 8077" sed -i 's/ListenPort=80/ListenPort=8077/g' ${systemdir}/${ini} sleep 1 - echo "" + echo "Forcing server to start to get ports/server name to display correctly" + sleep 1 cd ${rootdir} - echo "Default Settings" - echo "==============================" - echo "WebAdmin Details:" - echo "Url: http://localhost:8077" - echo "Username: admin" - echo "Password: utpass" - echo "" - echo "Port Details:" - echo "8077 TCP (WebAdmin Port)" - echo "7777 UDP (Game Port)" - echo "7778 UDP (Query Port)" - echo "7787 UDP (GameSpy Query Port)" - echo "28902 TCP & UDP (Allows your Server to Connect to the Master Server Browser)" - echo "20560 UDP (Steam Port)" + ${selfname} start + sleep 5 + ${selfname} restart + sleep 5 + ${selfname} stop + fn_header + fn_details echo "=================================" echo "Install Complete!" echo "" @@ -532,8 +580,10 @@ case "$1" in fn_compressmaps;; email-test) fn_emailtest;; + details) + fn_details;; *) - echo "Usage: $0 {start|stop|restart|monitor|install|debug|map-compressor|email-test}" + echo "Usage: $0 {start|stop|restart|monitor|install|debug|map-compressor|email-test|details}" exit 1;; esac exit \ No newline at end of file