From a9a911c07426f55be72a60ab60b06e106c2ba871 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sat, 2 Mar 2019 20:49:49 +0000 Subject: [PATCH 1/5] feat(servelist): add data to serverlist New data added to serverlist.csv. In future will be start to become easier to add servers as info can be added in to serverlist instead. This will happen over time --- lgsm/data/serverlist.csv | 164 +++++++++++++++++++++------------------ 1 file changed, 89 insertions(+), 75 deletions(-) diff --git a/lgsm/data/serverlist.csv b/lgsm/data/serverlist.csv index 3204c89ce..725b483d4 100644 --- a/lgsm/data/serverlist.csv +++ b/lgsm/data/serverlist.csv @@ -1,75 +1,89 @@ -shortname,servername,gamename,engine,glibc,x86,x64,steamcmd,steamlogin,gslt,query -arma3,arma3server,ARMA 3,realvirtuality,2.13,y,n,y,y,n,y -sdtd,sdtdserver,7 Days to Die,unity3d,2.15,y,n,y,y,n,y -ark,arkserver,ARK: Survival Evolved,unreal4,2.15,y,n,y,n,n,n -bo,boserver,Ballistic Overkill,unity3d,2.15,y,n,y,n,y,y -bf1942,bf1942server,Battlefield 1942,refractor,2,y,n,n,n,n,y -bmdm,bmdmserver,Black Mesa: Deathmatch,source,2.15,y,n,y,n,y,y -bs,bsserver,Blade Symphony,source,2.15,y,n,y,y,n,y -bb2,bb2server,BrainBread 2,source,2.17,y,n,y,n,y,y -cod,codserver,Call of Duty,idtech3,2.1,y,n,n,n,n,y -cod2,cod2server,Call of Duty 2,iw2.0,2.1.3,y,n,n,n,n,y -cod4,cod4server,Call of Duty 4,iw3.0,2.3,y,n,n,n,n,y -coduo,coduoserver,Call of Duty: United Offensive,idtech3,2.1,y,n,n,n,n,y -codwaw,codwawserver,Call of Duty: World at War,iw3.0,2.3.2,y,n,n,n,n,y -cc,ccserver,Codename CURE,source,2.15,y,n,y,n,n,y -cs,csserver,Counter-Strike 1.6,goldsource,2.3.6,y,n,y,n,n,y -cscz,csczserver,Counter-Strike: Condition Zero,goldsource,2.3.6,y,n,y,n,n,y -csgo,csgoserver,Counter-Strike: Global Offensive,source,2.15,y,n,y,n,y,y -css,cssserver,Counter-Strike: Source,source,2.3.6,y,n,y,n,y,y -dod,dodserver,Day of Defeat,goldsource,2.3.6,y,n,y,n,n,y -dods,dodsserver,Day of Defeat: Source,source,2.3.6,y,n,y,n,n,y -doi,doiserver,Day of Infamy,source,2.15,y,n,y,n,n,y -dmc,dmcserver,Deathmatch Classic,goldsource,2.3.6,y,n,y,n,n,y -dst,dstserver,Don't Starve Together,dontstarve,2.15,y,n,y,n,n,n -dab,dabserver,Double Action: Boogaloo,source,2.15,y,n,y,n,n,y -em,emserver,Empires Mod,source,2.15,y,n,y,n,y,y -fctr,fctrserver,Factorio,factorio,2.15,n,y,n,n,n,n -fof,fofserver,Fistful of Frags,source,2.15,y,n,y,n,n,y -gmod,gmodserver,Garrys Mod,source,2.15,y,n,y,n,y,y -ges,gesserver,GoldenEye: Source,source,2.15,y,n,n,n,n,y -hl2dm,hl2dmserver,Half-Life 2: Deathmatch,source,2.3.6,y,n,y,n,n,y -hldms,hldmsserver,Half-Life Deathmatch: Source,source,2.3.6,y,n,y,n,n,y -hldm,hldmserver,Half-Life: Deathmatch,goldsource,2.3.6,y,n,y,n,n,y -hw,hwserver,Hurtworld,unity3d,2.15,y,y,y,n,n,y -ins,insserver,Insurgency,source,2.15,y,n,y,n,y,y -jc2,jc2server,Just Cause 2,avalanche2.0,2.13,y,n,y,n,n,y -jc3,jc3server,Just Cause 3,avalanche3.0,2.17,y,n,y,n,n,y -kf,kfserver,Killing Floor,unreal2,2.4,y,n,y,y,n,y -kf2,kf2server,Killing Floor 2,unreal3,2.17,n,y,y,n,n,n -l4d,l4dserver,Left 4 Dead,source,2.3.6,y,n,y,n,n,y -l4d2,l4d2server,Left 4 Dead 2,source,2.3.6,y,n,y,n,n,y -mc,mcserver,Minecraft,lwjgl2,null,y,n,n,n,n,n -mta,mtaserver,Multi Theft Auto,renderware,2.7,y,y,n,n,n,n -mumble,mumbleserver,Mumble,null,null,y,n,n,n,n,n -ns2,ns2server,Natural Selection 2,spark,2.17,n,y,y,y,n,y -nmrih,nmrihserver,No More Room in Hell,source,2.15,y,n,y,n,y,y -ns2c,ns2cserver,NS2: Combat,spark,2.15,y,n,y,n,n,y -opfor,opforserver,Opposing Force,goldsource,2.3.6,y,n,y,n,n,y -pvkii,pvkiiserver,Pirates Vikings & Knights II,source,2.3.6,y,n,y,n,n,y -pc,pcserver,Project Cars,madness,2.4,y,n,y,n,n,y -pz,pzserver,Project Zomboid,projectzomboid,2.15,y,n,y,n,n,n -q2,q2server,Quake 2,idtech2,null,y,n,n,n,n,n -q3,q3server,Quake 3: Arena,idtech3,2.1,y,n,n,n,n,y -ql,qlserver,Quake Live,idtech3_ql,2.15,y,y,y,n,n,y -qw,qwserver,Quake World,quake,2.14,y,n,n,n,n,n -ro,roserver,Red Orchestra: Ostfront 41-45,unreal2,2.4,y,n,y,n,n,y -ricochet,ricochetserver,Ricochet,goldsource,2.3.6,y,n,y,n,n,y -rust,rustserver,Rust,unity3d,2.15,y,n,y,n,n,y -samp,sampserver,San Andreas Multiplayer,renderware,2.3,y,n,n,n,n,n -ss3,ss3server,Serious Sam 3: BFE,seriousengine35,2.13,y,n,y,n,n,n -sb,sbserver,Starbound,starbound,2.17,y,n,y,y,n,y -st,stserver,Stationeers,unity3d,2.15,n,y,y,n,n,y -squad,squadserver,Squad,unreal4,2.17,y,n,y,n,n,n -sven,svenserver,Sven Co-op,goldsource,2.18,y,n,y,n,n,y -tf2,tf2server,Team Fortress 2,source,2.15,y,n,y,n,y,y -tfc,tfcserver,Team Fortress Classic,goldsource,2.3.6,y,n,y,n,n,y -ts3,ts3server,Teamspeak 3,null,null,y,n,n,n,n,n -tw,twserver,Teeworlds,teeworlds,2.14,y,n,y,y,n,n -terraria,terrariaserver,Terraria,terraria,2.7,y,n,y,y,n,n -tu,tuserver,Tower Unite,unreal4,2.14,y,n,y,n,y,n -ut2k4,ut2k4server,Unreal Tournament 2004,unreal2,2.4,y,n,n,n,n,y -ut3,ut3server,Unreal Tournament 3,unreal3,2.3.2,y,n,n,n,n,n -ut99,ut99server,Unreal Tournament 99,unreal,2.1,y,n,n,n,n,y -wet,wetserver,Wolfenstein: Enemy Territory,idtech3,2.2.4,y,n,n,n,n,y -zps,zpsserver,Zombie Panic! Source,source,2.15,y,n,y,n,n,y +shortname,servername,gamename,engine,glibc,x86,x64,steamcmd,steamlogin,appid,appidmod,gslt,query +ark,arkserver,ARK: Survival Evolved,unreal4,2.15,y,n,y,n,376030,null,n,n +arma3,arma3server,ARMA 3,realvirtuality,2.13,y,n,y,y,233780,null,n,y +bb2,bbserver,Brainbread,goldsource,2.3.2,y,n,y,n,90,cstrike,n,y +bb2,bb2server,BrainBread 2,source,2.17,y,n,y,n,475370,null,y,y +bd,bdserver,Base Defense,source,2.14,y,n,y,n,817300,null,n,y +bf1942,bf1942server,Battlefield 1942,refractor,2,y,n,n,n,null,null,n,y +bmdm,bmdmserver,Black Mesa: Deathmatch,source,2.15,y,n,y,n,346680,null,y,y +bo,boserver,Ballistic Overkill,unity3d,2.15,y,n,y,n,416881,null,y,y +bs,bsserver,Blade Symphony,source,2.15,y,n,y,y,228780,null,n,y +bt1944,bt1944server,Battalion 1944,unreal4,2.17,y,n,y,n,805140,null,n,y +cc,ccserver,Codename CURE,source,2.15,y,n,y,n,383410,null,n,y +cod,codserver,Call of Duty,idtech3,2.1,y,n,n,n,null,null,n,y +cod2,cod2server,Call of Duty 2,iw2.0,2.1.3,y,n,n,n,null,null,n,y +cod4,cod4server,Call of Duty 4,iw3.0,2.3,y,n,n,n,null,null,n,y +coduo,coduoserver,Call of Duty: United Offensive,idtech3,2.1,y,n,n,n,null,null,n,y +codwaw,codwawserver,Call of Duty: World at War,iw3.0,2.3.2,y,n,n,n,null,null,n,y +cs,csserver,Counter-Strike 1.6,goldsource,2.3.6,y,n,y,n,90,cstrike,n,y +cscz,csczserver,Counter-Strike: Condition Zero,goldsource,2.3.6,y,n,y,n,90,czero,n,y +csgo,csgoserver,Counter-Strike: Global Offensive,source,2.15,y,n,y,n,740,null,y,y +css,cssserver,Counter-Strike: Source,source,2.3.6,y,n,y,n,232330,null,y,y +dab,dabserver,Double Action: Boogaloo,source,2.15,y,n,y,n,317800,null,n,y +dmc,dmcserver,Deathmatch Classic,goldsource,2.3.6,y,n,y,n,90,dmc,n,y +dod,dodserver,Day of Defeat,goldsource,2.3.6,y,n,y,n,90,dod,n,y +dods,dodsserver,Day of Defeat: Source,source,2.3.6,y,n,y,n,232290,null,n,y +doi,doiserver,Day of Infamy,source,2.15,y,n,y,n,462310,null,n,y +dst,dstserver,Don't Starve Together,null,2.15,y,n,y,n,343050,null,n,n +eco,ecoserver,Eco,unity3d,null,y,n,y,y,739590,null,n,y +em,emserver,Empires Mod,source,2.15,y,n,y,n,460040,null,y,y +etl,etlserver,ET: Legacy,idtech3,2.7,y,n,n,n,null,null,n,y +fctr,fctrserver,Factorio,null,2.15,n,y,n,n,null,null,n,n +fof,fofserver,Fistful of Frags,source,2.15,y,n,y,n,295230,null,n,y +ges,gesserver,GoldenEye: Source,source,2.15,y,n,n,n,310,null,n,y +gmod,gmodserver,Garrys Mod,source,2.15,y,n,y,n,4020,null,y,y +hl2dm,hl2dmserver,Half-Life 2: Deathmatch,source,2.3.6,y,n,y,n,232370,null,n,y +hldm,hldmserver,Half-Life: Deathmatch,goldsource,2.3.6,y,n,y,n,90,null,n,y +hldms,hldmsserver,Half-Life Deathmatch: Source,source,2.3.6,y,n,y,n,255470,null,n,y +hw,hwserver,Hurtworld,unity3d,2.15,y,y,y,n,405100,null,n,y +ins,insserver,Insurgency,source,2.15,y,n,y,n,237410,null,y,y +inss,inssserver,Insurgency: Sandstorm,unreal4,2.17,y,n,y,n,581330,null,n,y +io,iosserver,IOSoccer,source,2.15,y,n,y,n,673990,null,n,y +jc2,jc2server,Just Cause 2,avalanche2.0,2.13,y,n,y,n,261140,null,n,y +jc3,jc3server,Just Cause 3,avalanche3.0,2.17,y,n,y,n,619960,null,n,y +kf,kfserver,Killing Floor,unreal2,2.4,y,n,y,y,215360,null,n,y +kf2,kf2server,Killing Floor 2,unreal3,2.17,n,y,y,n,232130,null,n,n +l4d,l4dserver,Left 4 Dead,source,2.3.6,y,n,y,n,222860,null,n,y +l4d2,l4d2server,Left 4 Dead 2,source,2.3.6,y,n,y,n,222860,null,n,y +mc,mcserver,Minecraft,null,null,y,n,n,n,null,null,n,n +mta,mtaserver,Multi Theft Auto,renderware,2.7,y,y,n,n,null,null,n,n +mumble,mumbleserver,Mumble,null,null,y,n,n,n,null,null,n,n +nmrih,nmrihserver,No More Room in Hell,source,2.15,y,n,y,n,317670,null,y,y +ns,nsserver,Natural Selection,goldsource,2.3.2,y,n,y,n,90,cstrike,n,y +ns2,ns2server,Natural Selection 2,spark,2.17,n,y,y,y,313900,null,n,y +ns2c,ns2cserver,NS2: Combat,spark,2.15,y,n,y,n,313900,null,n,y +opfor,opforserver,Opposing Force,goldsource,2.3.6,y,n,y,n,90,gearbox,n,y +pc,pcserver,Project Cars,madness,2.4,y,n,y,n,332670,null,n,y +pstbs,pstbsserverĀ ,Post Scriptum,unreal4,2.17,n,y,y,y,746200,null,n,y +pvkii,pvkiiserver,Pirates Vikings & Knights II,source,2.3.6,y,n,y,n,17575,null,n,y +pz,pzserver,Project Zomboid,null,2.15,y,n,y,n,380870,null,n,n +q2,q2server,Quake 2,idtech2,null,y,n,n,n,null,null,n,n +q3,q3server,Quake 3: Arena,idtech3,2.1,y,n,n,n,null,null,n,y +ql,qlserver,Quake Live,idtech3_ql,2.15,y,y,y,n,349090,null,n,y +qw,qwserver,Quake World,quake,2.14,y,n,n,n,null,null,n,n +ricochet,ricochetserver,Ricochet,goldsource,2.3.6,y,n,y,n,90,ricochet,n,y +ro,roserver,Red Orchestra: Ostfront 41-45,unreal2,2.4,y,n,y,n,223250,null,n,y +rtcw,rtcwserver,Return to Castle Wolfenstein,ioquake3,2.1,y,n,n,n,null,null,n,y +rust,rustserver,Rust,unity3d,2.15,y,n,y,n,258550,null,n,y +rw,rwserver,Rising World,null,2.14,n,y,y,n,339010,null,n,y +samp,sampserver,San Andreas Multiplayer,renderware,2.3,y,n,n,n,null,null,n,n +sb,sbserver,Starbound,null,2.17,y,n,y,y,211820,null,n,y +sbots,sbotsserver,StickyBots,unreal4,2.17,,,y,n,974130,null,n,y +sdtd,sdtdserver,7 Days to Die,unity3d,2.15,y,n,y,y,294420,null,n,y +squad,squadserver,Squad,unreal4,2.17,y,n,y,n,403240,null,n,n +ss3,ss3server,Serious Sam 3: BFE,seriousengine35,2.13,y,n,y,n,41080,null,n,n +st,stserver,Stationeers,unity3d,2.15,n,y,y,n,600760,null,n,y +sven,svenserver,Sven Co-op,goldsource,2.18,y,n,y,n,276060,null,n,y +terraria,terrariaserver,Terraria,null,2.7,y,n,y,y,105600,null,n,n +tf2,tf2server,Team Fortress 2,source,2.15,y,n,y,n,232250,null,y,y +tfc,tfcserver,Team Fortress Classic,goldsource,2.3.6,y,n,y,n,90,tfc,n,y +ts3,ts3server,Teamspeak 3,null,null,y,n,n,n,null,null,n,n +tu,tuserver,Tower Unite,unreal4,2.14,y,n,y,n,439660,null,y,n +tw,twserver,Teeworlds,null,2.14,y,n,y,y,380840,null,n,n +ut2k4,ut2k4server,Unreal Tournament 2004,unreal2,2.4,y,n,n,n,null,null,n,y +ut3,ut3server,Unreal Tournament 3,unreal3,2.3.2,y,n,n,n,null,null,n,n +ut99,ut99server,Unreal Tournament 99,unreal,2.1,y,n,n,n,null,null,n,y +vs,vsserver,Vampire Slayer,goldsource,2.3.2,y,n,y,n,90,cstrike,n,y +wet,wetserver,Wolfenstein: Enemy Territory,idtech3,2.2.4,y,n,n,n,null,null,n,y +wurm,wurmserver,Wurm: Unlimited,null,2.14,y,n,y,n,402370,null,n,y +zps,zpsserver,Zombie Panic! Source,source,2.15,y,n,y,n,17505,null,n,y From 6a64042996885f46c2d90dc0e7f830ba4b793ed6 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sat, 2 Mar 2019 20:51:45 +0000 Subject: [PATCH 2/5] tidy up comments --- lgsm/functions/command_stop.sh | 45 ++++++++++++++++------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/lgsm/functions/command_stop.sh b/lgsm/functions/command_stop.sh index fc43476e6..c0f7ee3d7 100644 --- a/lgsm/functions/command_stop.sh +++ b/lgsm/functions/command_stop.sh @@ -9,13 +9,13 @@ local commandname="STOP" local commandaction="Stopping" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -# Attempts graceful shutdown by sending the 'CTRL+c'. +# Attempts graceful shutdown by sending 'CTRL+c'. fn_stop_graceful_ctrlc(){ fn_print_dots "Graceful: CTRL+c" fn_script_log_info "Graceful: CTRL+c" # sends quit tmux send-keys -t "${servicename}" C-c > /dev/null 2>&1 - # waits up to 30 seconds giving the server time to shutdown gracefuly + # Waits up to 30 seconds giving the server time to shutdown gracefuly. for seconds in {1..30}; do check_status.sh if [ "${status}" == "0" ]; then @@ -44,7 +44,7 @@ fn_stop_graceful_cmd(){ fn_script_log_info "Graceful: sending \"${1}\"" # sends specific stop command tmux send -t "${servicename}" "${1}" ENTER > /dev/null 2>&1 - # waits up to given seconds giving the server time to shutdown gracefully + # Waits up to ${seconds} seconds giving the server time to shutdown gracefully. for ((seconds=1; seconds<=${2}; seconds++)); do check_status.sh if [ "${status}" == "0" ]; then @@ -65,16 +65,15 @@ fn_stop_graceful_cmd(){ sleep 0.5 } -# Attempts graceful of goldsource using rcon 'quit' command. -# Goldsource 'quit' command restarts rather than shutdown -# this function will only wait 3 seconds then force a tmux shutdown. -# preventing the server from coming back online. +# Attempts graceful shutdown of goldsource using rcon 'quit' command. +# There is only a 3 second delay before a forced a tmux shutdown +# as Goldsource servers 'quit' command does a restart rather than shutdown. fn_stop_graceful_goldsource(){ fn_print_dots "Graceful: sending \"quit\"" fn_script_log_info "Graceful: sending \"quit\"" # sends quit tmux send -t "${servicename}" quit ENTER > /dev/null 2>&1 - # waits 3 seconds as goldsource servers restart with the quit command + # Waits 3 seconds as goldsource servers restart with the quit command. for seconds in {1..3}; do sleep 1 fn_print_dots "Graceful: sending \"quit\": ${seconds}" @@ -85,7 +84,7 @@ fn_stop_graceful_goldsource(){ sleep 0.5 } -# Attempts graceful of 7 Days To Die using telnet. + fn_stop_telnet_sdtd(){ if [ -z "${telnetpass}" ]||[ "${telnetpass}" == "NOT SET" ]; then sdtd_telnet_shutdown=$( expect -c ' @@ -122,6 +121,7 @@ fn_stop_telnet_sdtd(){ fi } +# Attempts graceful shutdown of 7 Days To Die using telnet. fn_stop_graceful_sdtd(){ fn_print_dots "Graceful: telnet" fn_script_log_info "Graceful: telnet" @@ -147,8 +147,8 @@ fn_stop_graceful_sdtd(){ fi done - # If telnet was successful will use telnet again to check the connection has closed - # This confirms that the tmux session can now be killed. + # If telnet shutdown was successful will use telnet again to check + # the connection has closed, confirming that the tmux session can now be killed. if [ -n "${completed}" ]; then for seconds in {1..30}; do fn_stop_telnet_sdtd @@ -162,8 +162,7 @@ fn_stop_graceful_sdtd(){ sleep 1 fn_print_dots "Graceful: telnet: ${seconds}" done - # If telnet failed will go straight to tmux shutdown. - # If cannot shutdown correctly world save may be lost + # If telnet shutdown fails tmux shutdown will be used, this risks loss of world save. else if [ -n "${refused}" ]; then fn_print_error "Graceful: telnet: " @@ -196,7 +195,8 @@ fn_stop_graceful_select(){ elif [ "${shortname}" == "mc" ]; then fn_stop_graceful_cmd "stop" 30 elif [ "${shortname}" == "mta" ]; then - # we need a long wait time here as resources are stopped individually and process their own shutdowns + # long wait time required for mta + # as resources shutdown individually fn_stop_graceful_cmd "quit" 120 elif [ "${engine}" == "goldsource" ]; then fn_stop_graceful_goldsource @@ -208,7 +208,8 @@ fn_stop_graceful_select(){ } fn_stop_ark(){ - maxpiditer=15 # The maximum number of times to check if the ark pid has closed gracefully. + # The maximum number of times to check if the ark pid has closed gracefully. + maxpiditer=15 info_config.sh if [ -z "${queryport}" ]; then fn_print_warn "No queryport found using info_config.sh" @@ -226,8 +227,7 @@ fn_stop_ark(){ if [ "${#queryport}" -gt 0 ] ; then for (( pidcheck=0 ; pidcheck < ${maxpiditer} ; pidcheck++ )) ; do pid=$(netstat -nap 2>/dev/null | grep "^udp[[:space:]]" | grep ":${queryport}[[:space:]]" | rev | awk '{print $1}' | rev | cut -d\/ -f1) - # - # check for a valid pid + # Check for a valid pid. pid=${pid//[!0-9]/} let pid+=0 # turns an empty string into a valid number, '0', # and a valid numeric pid remains unchanged. @@ -235,7 +235,7 @@ fn_stop_ark(){ fn_print_dots "Process still bound. Awaiting graceful exit: ${pidcheck}" sleep 0.5 else - break # Our job is done here + break fi # end if for pid range check done if [[ ${pidcheck} -eq ${maxpiditer} ]] ; then @@ -253,7 +253,6 @@ fn_stop_teamspeak3(){ "${serverfiles}"/ts3server_startscript.sh stop > /dev/null 2>&1 check_status.sh if [ "${status}" == "0" ]; then - # Remove lockfile rm -f "${rootdir}/${lockselfname}" fn_print_ok_nl "${servername}" fn_script_log_pass "Stopped ${servername}" @@ -267,12 +266,11 @@ fn_stop_tmux(){ fn_print_dots "${servername}" fn_script_log_info "tmux kill-session: ${servername}" sleep 0.5 - # Kill tmux session tmux kill-session -t "${servicename}" > /dev/null 2>&1 sleep 0.5 check_status.sh if [ "${status}" == "0" ]; then - # ARK doesn't clean up immediately after tmux is killed. + # ARK does not clean up immediately after tmux is killed. # Make certain the ports are cleared before continuing. if [ "${shortname}" == "ark" ]; then fn_stop_ark @@ -285,10 +283,9 @@ fn_stop_tmux(){ fi } -# checks if the server is already stopped before trying to stop. +# Checks if the server is already stopped. fn_stop_pre_check(){ -# Is the server already stopped - if [ "${status}" == "0" ]; then # $status comes from check_status.sh, which is run by check.sh for this command + if [ "${status}" == "0" ]; then fn_print_info_nl "${servername} is already stopped" fn_script_log_error "${servername} is already stopped" elif [ "${shortname}" == "ts3" ]; then From 4fa0269c183fae51a90e7b298fd88e5b74b395af Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sat, 2 Mar 2019 20:53:17 +0000 Subject: [PATCH 3/5] fix(stop): correct if statements --- lgsm/functions/command_stop.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lgsm/functions/command_stop.sh b/lgsm/functions/command_stop.sh index c0f7ee3d7..3f8782557 100644 --- a/lgsm/functions/command_stop.sh +++ b/lgsm/functions/command_stop.sh @@ -188,7 +188,7 @@ fn_stop_graceful_sdtd(){ fn_stop_graceful_select(){ if [ "${shortname}" == "sdtd" ]; then fn_stop_graceful_sdtd - elif [ "${engine}" == "Spark" ]; then + elif [ "${engine}" == "spark" ]; then fn_stop_graceful_cmd "q" 30 elif [ "${shortname}" == "terraria" ]; then fn_stop_graceful_cmd "exit" 30 @@ -202,7 +202,7 @@ fn_stop_graceful_select(){ fn_stop_graceful_goldsource elif [ "${engine}" == "unity3d" ]||[ "${engine}" == "unreal4" ]||[ "${engine}" == "unreal3" ]||[ "${engine}" == "unreal2" ]||[ "${engine}" == "unreal" ]||[ "${shortname}" == "fctr" ]||[ "${shortname}" == "mumble" ]||[ "${shortname}" == "wurm" ]||[ "${shortname}" == "jc2" ]||[ "${shortname}" == "jc3" ]; then fn_stop_graceful_ctrlc - elif [ "${engine}" == "source" ]||[ "${engine}" == "quake" ]||[ "${engine}" == "idtech2" ]||[ "${engine}" == "idtech3" ]||[ "${engine}" == "idtech3_ql" ]||[ "${shortname}" == "jc2" ]||[ "${shortname}" == "pz" ]||[ "${shortname}" == "rw" ]; then + elif [ "${engine}" == "source" ]||[ "${engine}" == "quake" ]||[ "${engine}" == "idtech2" ]||[ "${engine}" == "idtech3" ]||[ "${engine}" == "idtech3_ql" ]||[ "${shortname}" == "pz" ]||[ "${shortname}" == "rw" ]; then fn_stop_graceful_cmd "quit" 30 fi } From f4e7eb8ad7a340bf1ec6ab269ca05fb0fb47159b Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sat, 2 Mar 2019 21:00:48 +0000 Subject: [PATCH 4/5] comment tidy --- lgsm/functions/command_stop.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lgsm/functions/command_stop.sh b/lgsm/functions/command_stop.sh index 3f8782557..77d0e0f60 100644 --- a/lgsm/functions/command_stop.sh +++ b/lgsm/functions/command_stop.sh @@ -13,7 +13,7 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_stop_graceful_ctrlc(){ fn_print_dots "Graceful: CTRL+c" fn_script_log_info "Graceful: CTRL+c" - # sends quit + # Sends quit. tmux send-keys -t "${servicename}" C-c > /dev/null 2>&1 # Waits up to 30 seconds giving the server time to shutdown gracefuly. for seconds in {1..30}; do @@ -38,11 +38,11 @@ fn_stop_graceful_ctrlc(){ # Attempts graceful shutdown by sending a specified command. # Usage: fn_stop_graceful_cmd "console_command" "timeout_in_seconds" -# e.g.: fn_stop_graceful_cmd "quit" "30" +# e.g.: fn_stop_graceful_cmd "quit" "30" fn_stop_graceful_cmd(){ fn_print_dots "Graceful: sending \"${1}\"" fn_script_log_info "Graceful: sending \"${1}\"" - # sends specific stop command + # Sends specific stop command. tmux send -t "${servicename}" "${1}" ENTER > /dev/null 2>&1 # Waits up to ${seconds} seconds giving the server time to shutdown gracefully. for ((seconds=1; seconds<=${2}; seconds++)); do @@ -236,7 +236,7 @@ fn_stop_ark(){ sleep 0.5 else break - fi # end if for pid range check + fi done if [[ ${pidcheck} -eq ${maxpiditer} ]] ; then # The process doesn't want to close after 20 seconds. @@ -244,8 +244,8 @@ fn_stop_ark(){ fn_print_error "Terminating reluctant Ark process: ${pid}" kill -9 ${pid} fi - fi # end if for port check -} # end of fn_stop_ark + fi +} fn_stop_teamspeak3(){ fn_print_dots "${servername}" @@ -293,7 +293,7 @@ fn_stop_pre_check(){ else fn_stop_graceful_select fi - # Check status again, a stop tmux session if needed + # Check status again, a stop tmux session if needed. check_status.sh if [ "${status}" != "0" ]; then fn_stop_tmux @@ -305,7 +305,7 @@ sleep 0.5 check.sh info_config.sh fn_stop_pre_check -# Remove lockfile +# Remove lockfile. if [ -f "${rootdir}/${lockselfname}" ]; then rm -f "${rootdir}/${lockselfname}" fi From 85731e1510c32fea4c5a5fd227bbdf8128a07c2c Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sat, 2 Mar 2019 22:22:03 +0000 Subject: [PATCH 5/5] feat(serverlist): add compatibility for updated serverlist.csv --- linuxgsm.sh | 58 +++++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/linuxgsm.sh b/linuxgsm.sh index 126bccf88..6ffc9caa4 100755 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -37,6 +37,7 @@ libdir="${lgsmdir}/lib" tmpdir="${lgsmdir}/tmp" datadir="${lgsmdir}/data" serverlist="${datadir}/serverlist.csv" +serverlistmenu="${datadir}/serverlistmenu.csv" configdir="${lgsmdir}/config-lgsm" configdirserver="${configdir}/${gameservername}" configdirdefault="${lgsmdir}/config-default" @@ -49,16 +50,16 @@ githubuser="GameServerManagers" githubrepo="LinuxGSM" githubbranch="master" -# Core Function that is required first +# Core function that is required first. core_functions.sh(){ functionfile="${FUNCNAME}" fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5" } # Bootstrap -# Fetches the core functions required before passed off to core_dl.sh +# Fetches the core functions required before passed off to core_dl.sh. -# Fetches core functions +# Fetches core functions. fn_bootstrap_fetch_file(){ remote_fileurl="${1}" local_filedir="${2}" @@ -67,17 +68,17 @@ fn_bootstrap_fetch_file(){ run="${5:-0}" forcedl="${6:-0}" md5="${7:-0}" - # download file if missing or download forced + # Download file if missing or download forced. if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then if [ ! -d "${local_filedir}" ]; then mkdir -p "${local_filedir}" fi - # Defines curl path + # Defines curl path. curlpath=$(command -v curl 2>/dev/null) - # If curl exists download file + # If curl exists download file. if [ "$(basename "${curlpath}")" == "curl" ]; then - # trap to remove part downloaded files + # Trap to remove part downloaded files. echo -en " fetching ${local_filename}...\c" curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1) local exitcode=$? @@ -95,14 +96,14 @@ fn_bootstrap_fetch_file(){ echo "[ FAIL ] Curl is not installed" exit 1 fi - # make file chmodx if chmodx is set + # Make file chmodx if chmodx is set. if [ "${chmodx}" == "chmodx" ]; then chmod +x "${local_filedir}/${local_filename}" fi fi if [ -f "${local_filedir}/${local_filename}" ]; then - # run file if run is set + # Run file if run is set. if [ "${run}" == "run" ]; then source "${local_filedir}/${local_filename}" fi @@ -121,11 +122,11 @@ fn_bootstrap_fetch_file_github(){ run="${5:-0}" forcedl="${6:-0}" md5="${7:-0}" - # Passes vars to the file download function + # Passes vars to the file download function. fn_bootstrap_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}" } -# Installer menu +# Installer menu. fn_print_center() { columns="$(tput cols)" @@ -138,7 +139,7 @@ fn_print_horizontal(){ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "${char}" } -# Bash Menu +# Bash menu. fn_install_menu_bash() { local resultvar=$1 title=$2 @@ -162,7 +163,7 @@ fn_install_menu_bash() { done } -# Whiptail/Dialog Menu +# Whiptail/Dialog menu. fn_install_menu_whiptail() { local menucmd=$1 local resultvar=$2 @@ -187,14 +188,14 @@ fn_install_menu_whiptail() { fi } -# Menu selector +# Menu selector. fn_install_menu() { local resultvar=$1 local selection="" title=$2 caption=$3 options=$4 - # Get menu command + # Get menu command. for menucmd in whiptail dialog bash; do if [ -x "$(command -v "${menucmd}")" ]; then menucmd=$(command -v "${menucmd}") @@ -210,7 +211,7 @@ fn_install_menu() { eval "$resultvar=\"${selection}\"" } -# Gets server info from serverlist.csv and puts in to array +# Gets server info from serverlist.csv and puts in to array. fn_server_info(){ IFS="," server_info_array=($(grep -aw "${userinput}" "${serverlist}")) @@ -228,7 +229,7 @@ fn_install_getopt(){ echo -e "" echo -e "Commands" echo -e "install\t\t| Select server to install." - echo -e "servername\t| e.g $0 csgoserver. Enter name of server/game to install." + echo -e "servername\t| Enter name of game server to install. e.g $0 csgoserver." echo -e "list\t\t| List all servers available for install." exit } @@ -273,7 +274,7 @@ if [ "$(whoami)" == "root" ]; then fi fi -# LinuxGSM installer mode +# LinuxGSM installer mode. if [ "${shortname}" == "core" ]; then # Download the latest serverlist. This is the complete list of all supported servers. fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5" @@ -282,13 +283,14 @@ if [ "${shortname}" == "core" ]; then exit 1 fi - if [ "${userinput}" == "list" ]; then + if [ "${userinput}" == "list" ]||[ "${userinput}" == "l" ]; then { - tail -n +2 "${serverlist}"|awk -F "," '{print $2 "\t" $3}' + tail -n +2 "${serverlist}" | awk -F "," '{print $2 "\t" $3}' } | column -s $'\t' -t | more exit elif [ "${userinput}" == "install" ]||[ "${userinput}" == "i" ]; then - fn_install_menu result "LinuxGSM" "Select game to install" "${serverlist}" + tail -n +2 "${serverlist}" | awk -F "," '{print $1 "," $2 "," $3}' > "${serverlistmenu}" + fn_install_menu result "LinuxGSM" "Select game server to install." "${serverlistmenu}" userinput="${result}" fn_server_info if [ "${result}" == "${gameservername}" ]; then @@ -311,11 +313,11 @@ if [ "${shortname}" == "core" ]; then fn_install_getopt fi -# LinuxGSM Server Mode +# LinuxGSM server mode. else core_functions.sh if [ "${shortname}" != "core-dep" ]; then - # Load LinuxGSM configs + # Load LinuxGSM configs. # These are required to get all the default variables for the specific server. # Load the default config. If missing download it. If changed reload it. if [ ! -f "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" ]; then @@ -349,14 +351,14 @@ else fi fi source "${configdirserver}/_default.cfg" - # Load the common.cfg config. If missing download it + # Load the common.cfg config. If missing download it. if [ ! -f "${configdirserver}/common.cfg" ]; then fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5" source "${configdirserver}/common.cfg" else source "${configdirserver}/common.cfg" fi - # Load the instance.cfg config. If missing download it + # Load the instance.cfg config. If missing download it. if [ ! -f "${configdirserver}/${servicename}.cfg" ]; then fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${servicename}.cfg" "nochmodx" "norun" "noforcedl" "nomd5" source "${configdirserver}/${servicename}.cfg" @@ -364,14 +366,14 @@ else source "${configdirserver}/${servicename}.cfg" fi - # Load the linuxgsm.sh in to tmpdir. If missing download it + # Load the linuxgsm.sh in to tmpdir. If missing download it. if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "chmodx" "norun" "noforcedl" "nomd5" fi fi - # Enables ANSI colours from core_messages.sh. Can be disabled with ansi=off + # Enables ANSI colours from core_messages.sh. Can be disabled with ansi=off. fn_ansi_loader - # Prevents running of core_exit.sh for Travis. + # Prevents running of core_exit.sh for Travis-CI. if [ "${travistest}" != "1" ]; then getopt=$1 core_getopt.sh