Răsfoiți Sursa

fix(monitor): run the update when a Source server asks for one (#5178)

When a Source server prints "Your server needs to be restarted in order
to receive the latest update.", monitor only restarted it. A restart does
not run SteamCMD (updateonstart is off by default), so the server came
back on the old build, printed the same message, and monitor restarted it
again on every run.

Monitor now writes a forced update request instead. The existing
update-request handling later in the same monitor run waits until the
server is empty, then runs a forced update in the background, which
stops the server, updates it and starts it again. The request is only
written, and the alert only sent, once, so a postponed update no longer
repeats the alert on every monitor run.

Fixes #5175
Daniel Gibbs 1 zi în urmă
părinte
comite
7ad430b1d8
2 a modificat fișierele cu 7 adăugiri și 5 ștergeri
  1. 1 1
      lgsm/modules/alert.sh
  2. 6 4
      lgsm/modules/command_monitor.sh

+ 1 - 1
lgsm/modules/alert.sh

@@ -129,7 +129,7 @@ fn_alert_update_restart_request() {
 	alertaction="Restart Requested"
 	alertemoji="🎉"
 	alertsound="1"
-	alertmessage="${selfname} has requested a restart for an update to be applied. Restarting now."
+	alertmessage="${selfname} has requested a restart for an update to be applied. Updating once the server is empty."
 	# Blue
 	alertcolourhex="#1e90ff"
 	alertcolourdec="2003199"

+ 6 - 4
lgsm/modules/command_monitor.sh

@@ -260,10 +260,12 @@ fn_monitor_check_update_source() {
 			fn_print_ok "Checking update"
 			fn_print_ok_eol_nl
 			fn_script_log_info "Checking update: ${selfname} has requested a restart for an update to be applied"
-			alert="update-restart-request"
-			alert.sh
-			command_restart.sh
-			core_exit.sh
+			if [ ! -f "${lockdir}/${selfname}-update-request.lock" ]; then
+				alert="update-restart-request"
+				alert.sh
+				date '+%s' > "${lockdir:?}/${selfname}-update-request.lock"
+				echo "force" >> "${lockdir:?}/${selfname}-update-request.lock"
+			fi
 		fi
 	fi
 }