Explorar el Código

Scripts now check if SteamCMD is missing

Sometimes I need to delete the SteamCMD dir for testing. I have added
functionality to automatically re download if missing. Will also prevent
any risk of steamcmd.sh command no found error.
Daniel Gibbs hace 11 años
padre
commit
6f560a9acb
Se han modificado 3 ficheros con 49 adiciones y 20 borrados
  1. 3 2
      functions/fn_startserver
  2. 44 17
      functions/fn_steamdl
  3. 2 1
      functions/fn_updateserver

+ 3 - 2
functions/fn_startserver

@@ -2,7 +2,7 @@
 # LGSM fn_startserver function
 # Author: Daniel Gibbs
 # Website: http://danielgibbs.co.uk
-# Version: 010115
+# Version: 090115
 
 # Description: Starts the server.
 
@@ -18,8 +18,9 @@ fn_parms
 fn_logmanager
 fn_printdots "${servername}"
 fn_scriptlog "${servername}"
-fn_tmuxcheck
 sleep 1
+fn_tmuxcheck
+fn_steamdl
 tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
 if [ "${tmuxwc}" -eq 0 ]; then
 	fn_scriptlog "Rotating log files"

+ 44 - 17
functions/fn_steamdl

@@ -2,23 +2,50 @@
 # LGSM fn_steamdl function
 # Author: Daniel Gibbs
 # Website: http://danielgibbs.co.uk
-# Version: 241214
+# Version: 090115
 
-echo ""
-echo "Installing SteamCMD"
-echo "================================="
-cd "${rootdir}"
-mkdir -pv "steamcmd"
-sleep 1
-cd "steamcmd"
-if [ ! -f steamcmd.sh ]; then
-	echo -e "downloading steamcmd_linux.tar.gz...\c"
-	wget -N --no-check-certificate /dev/null http://media.steampowered.com/client/steamcmd_linux.tar.gz 2>&1 | grep -F HTTP | cut -c45-| uniq
-	tar --verbose -zxf steamcmd_linux.tar.gz
-	rm -v steamcmd_linux.tar.gz
-	chmod +x steamcmd.sh
-	sleep 1
+# Description: Downloads SteamCMD on install and checks if missing before running functions that require SteamCMD
+
+
+if [ "${gamename}" == "Unreal Tournament 99" ]||[ "${modulename}" == "Unreal Tournament 2004" ]; then
+	: # These servers do not require SteamCMD. Check is skipped.
+elif [ "${modulename}" == "Starting" ]||[ "${modulename}" == "Update" ]; then
+	# Checks if SteamCMD exists when starting or updating a server.
+	# Re-installs if missing.
+	if [ ! -f ${rootdir}/steamcmd/steamcmd.sh ]; then
+		fn_printwarn "SteamCMD is missing"
+		fn_scriptlog "SteamCMD is missing"
+		sleep 1
+		echo -en "\n"
+		mkdir -pv "${rootdir}/steamcmd"
+		cd "${rootdir}/steamcmd"
+		echo -e "downloading steamcmd_linux.tar.gz...\c"
+		wget -N --no-check-certificate /dev/null http://media.steampowered.com/client/steamcmd_linux.tar.gz 2>&1 | grep -F HTTP | cut -c45-| uniq
+		tar --verbose -zxf steamcmd_linux.tar.gz
+		rm -v steamcmd_linux.tar.gz
+		chmod +x steamcmd.sh
+		fn_scriptlog "Re-installed SteamCMD"
+		fn_printdots "${servername}"
+		sleep 1
+	fi
+	cd "${rootdir}"
 else
-	echo "Steam already installed!"
+	echo ""
+	echo "Installing SteamCMD"
+	echo "================================="
+	cd "${rootdir}"
+	mkdir -pv "steamcmd"
+	sleep 1
+	cd "steamcmd"
+	if [ ! -f steamcmd.sh ]; then
+			echo -e "downloading steamcmd_linux.tar.gz...\c"
+			wget -N --no-check-certificate /dev/null http://media.steampowered.com/client/steamcmd_linux.tar.gz 2>&1 | grep -F HTTP | cut -c45-| uniq
+			tar --verbose -zxf steamcmd_linux.tar.gz
+			rm -v steamcmd_linux.tar.gz
+			chmod +x steamcmd.sh
+			sleep 1
+	else
+			echo "Steam already installed!"
+	fi
+	sleep 1
 fi
-sleep 1

+ 2 - 1
functions/fn_updateserver

@@ -2,7 +2,7 @@
 # LGSM fn_updateserver function
 # Author: Daniel Gibbs
 # Website: http://danielgibbs.co.uk
-# Version: 010115
+# Version: 090115
 
 # Description: Runs a server update.
 
@@ -11,6 +11,7 @@ fn_rootcheck
 fn_syscheck
 fn_printdots "Updating ${servername}"
 sleep 1
+fn_steamdl
 fn_printok "Updating ${servername}"
 fn_scriptlog "Updating ${servername}"
 sleep 1