Files
sap-erp/deploy/stop-server.bat
T
John 69b4e68baf
SAP-ERP Portal CI/CD / build (push) Failing after 5m20s
first commit
2026-09-23 17:31:02 +05:30

24 lines
1.3 KiB
Batchfile

@echo off
rem ==================================================================
rem Stops the portal: ends the supervisor loop AND the node process.
rem (Only kills the node.exe running THIS app's server.js - other
rem Node programs on the machine are untouched.)
rem ==================================================================
echo Stopping SAP-ERP Portal...
rem End the scheduled-task instance (if it was started via autostart)
schtasks /End /TN "SAP-ERP-Portal" >nul 2>&1
rem Kill the supervisor console (titled window), if running in foreground
taskkill /F /FI "WINDOWTITLE eq SAP-ERP-Portal*" >nul 2>&1
rem Kill any cmd.exe still running the supervisor loop
powershell -NoProfile -Command "Get-CimInstance Win32_Process | Where-Object { $_.Name -eq 'cmd.exe' -and $_.CommandLine -match 'start-server\.bat' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }"
rem Kill the node process running server.js (works whatever the app folder
rem is named; on a dedicated portal server no other node app runs server.js)
powershell -NoProfile -Command "Get-CimInstance Win32_Process | Where-Object { $_.Name -eq 'node.exe' -and $_.CommandLine -match 'server\.js' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force; Write-Host (' stopped node PID ' + $_.ProcessId) }"
echo Stopped.
pause