diff --git a/deployment/windows/scripts/menu.ps1 b/deployment/windows/scripts/menu.ps1 index b0bbaf9..1ce3eba 100644 --- a/deployment/windows/scripts/menu.ps1 +++ b/deployment/windows/scripts/menu.ps1 @@ -295,11 +295,35 @@ function Invoke-GitPullRestart { Write-Host "[SUCCES] Proiect actualizat!" -ForegroundColor Green Write-Host "" - # Restart service if installed + # Restart service if installed (inline, fara script extern) $service = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue if ($service) { - Write-Host "[INFO] Restart serviciu..." -ForegroundColor Cyan - & "$ScriptDir\restart_service.ps1" + Write-Host "[INFO] Oprire serviciu..." -ForegroundColor Cyan + try { + Stop-Service -Name $ServiceName -Force + Write-Host "[OK] Serviciu oprit" -ForegroundColor Green + Start-Sleep -Seconds 2 + } catch { + Write-Host "[AVERTIZARE] Oprirea a esuat, incercam oprire fortata..." -ForegroundColor Yellow + sc.exe stop $ServiceName | Out-Null + Start-Sleep -Seconds 2 + } + + Write-Host "[INFO] Pornire serviciu..." -ForegroundColor Cyan + try { + Start-Service -Name $ServiceName + Start-Sleep -Seconds 2 + + $service = Get-Service -Name $ServiceName + if ($service.Status -eq "Running") { + Write-Host "[SUCCES] Serviciu restartat cu succes!" -ForegroundColor Green + } else { + Write-Host "[EROARE] Serviciul nu ruleaza dupa restart!" -ForegroundColor Red + } + } catch { + Write-Host "[EROARE] Pornirea serviciului a esuat!" -ForegroundColor Red + Write-Host "Verificati logurile pentru detalii" -ForegroundColor Yellow + } } else { Write-Host "[INFO] Serviciul nu este instalat, restart nu este necesar" -ForegroundColor Yellow }