fix(update): restart service if stopped even when no git updates

Previously update.ps1 exited immediately when no updates were available,
leaving the service stopped if a prior restart had failed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-04-01 14:02:47 +00:00
parent aa9e580e1b
commit 452bcd698e

View File

@@ -45,7 +45,17 @@ $local = git rev-parse HEAD
$remote = git rev-parse FETCH_HEAD
if ($local -eq $remote) {
# Verify service is running even when no updates
$status = (nssm status GoMagVending 2>&1) -replace '\0',''
if ($status -ne 'SERVICE_RUNNING') {
Log "Nicio actualizare, dar serviciul nu ruleaza ($status). Restart..." "Yellow"
nssm restart GoMagVending 2>&1 | Out-Null
Start-Sleep -Seconds 3
$status = (nssm status GoMagVending 2>&1) -replace '\0',''
Log "Serviciu: $status" "Green"
} else {
Log "Nicio actualizare disponibila." "Gray"
}
exit 0
}