Browse Source

Fixed updateonstart not functioning correctly

bug: when update on restart is set to on it was not working. Also moved
code to make the update message come before the start message
Daniel Gibbs 10 years ago
parent
commit
baf75404ed
1 changed files with 28 additions and 18 deletions
  1. 28 18
      functions/fn_start

+ 28 - 18
functions/fn_start

@@ -2,7 +2,7 @@
 # LGSM fn_start function
 # LGSM fn_start function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-# Version: 150715
+# Version: 261015
 
 
 # Description: Starts the server.
 # Description: Starts the server.
 
 
@@ -13,13 +13,14 @@ fn_check_root
 fn_check_systemdir
 fn_check_systemdir
 fn_check_logs
 fn_check_logs
 fn_check_ts3status
 fn_check_ts3status
-if [ "${ts3status}" = "Server is running" ]; then
-	fn_printinfo "${servername} is already running"
-	fn_scriptlog "${servername} is already running"
-	sleep 1
-	echo -en "\n"
-	exit
+
+if [ "${ts3status}" != "Server is running" ]; then
+	# Will check for updates is updateonstart is yes
+	if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then
+		fn_update_check
+	fi	
 fi
 fi
+
 if [ ! -e "${servercfgfullpath}" ]; then
 if [ ! -e "${servercfgfullpath}" ]; then
 	fn_printwarn "${servercfgfullpath} is missing"
 	fn_printwarn "${servercfgfullpath} is missing"
 	fn_scriptlog "${servercfgfullpath} is missing"
 	fn_scriptlog "${servercfgfullpath} is missing"
@@ -36,16 +37,21 @@ if [ ! -e "${servercfgfullpath}" ]; then
 	sleep 5
 	sleep 5
 	touch "${servercfgfullpath}"
 	touch "${servercfgfullpath}"
 fi
 fi
-fn_logs
 
 
-# Will check for updates is updateonstart is yes
-if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then
-	fn_update_check
-fi
+fn_logs
 
 
 fn_printdots "${servername}"
 fn_printdots "${servername}"
 fn_scriptlog "${servername}"
 fn_scriptlog "${servername}"
 sleep 1
 sleep 1
+
+if [ "${ts3status}" == "Server is running" ]; then
+	fn_printinfo "${servername} is already running"
+	fn_scriptlog "${servername} is already running"
+	sleep 1
+	echo -en "\n"
+	exit
+fi
+
 mv "${scriptlog}" "${scriptlogdate}"
 mv "${scriptlog}" "${scriptlogdate}"
 # Create lock file
 # Create lock file
 date > "${rootdir}/${lockselfname}"
 date > "${rootdir}/${lockselfname}"
@@ -80,20 +86,24 @@ fi
 fn_details_config
 fn_details_config
 fn_parms
 fn_parms
 fn_logs
 fn_logs
+
+tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
+# Will check for updates if updateonstart is yes
+if [ "${tmuxwc}" -eq 0 ]; then
+	if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then
+		fn_update_check
+	fi
+fi
+
 fn_printdots "${servername}"
 fn_printdots "${servername}"
 fn_scriptlog "${servername}"
 fn_scriptlog "${servername}"
 sleep 1
 sleep 1
 fn_check_tmux
 fn_check_tmux
+
 if [ "${gamename}" != "Mumble" ]; then
 if [ "${gamename}" != "Mumble" ]; then
 	fn_check_steamcmd
 	fn_check_steamcmd
 fi
 fi
 
 
-# Will check for updates if updateonstart is yes
-if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]; then
-	fn_update_check
-fi
-
-tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
 if [ "${tmuxwc}" -eq 0 ]; then
 if [ "${tmuxwc}" -eq 0 ]; then
 	fn_scriptlog "Rotating log files"
 	fn_scriptlog "Rotating log files"
 	if [ "${engine}" == "unreal2" ]; then
 	if [ "${engine}" == "unreal2" ]; then