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:
12
update.ps1
12
update.ps1
@@ -45,7 +45,17 @@ $local = git rev-parse HEAD
|
||||
$remote = git rev-parse FETCH_HEAD
|
||||
|
||||
if ($local -eq $remote) {
|
||||
Log "Nicio actualizare disponibila." "Gray"
|
||||
# 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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user