Files
John 69b4e68baf
SAP-ERP Portal CI/CD / build (push) Failing after 5m20s
first commit
2026-09-23 17:31:02 +05:30

27 lines
1.0 KiB
Batchfile

@echo off
rem ==================================================================
rem SAP-ERP Portal - supervisor loop.
rem Runs the Node server and AUTOMATICALLY RESTARTS it if it ever
rem crashes. All output goes to the logs\ folder.
rem Run directly for a visible console, or via run-hidden.vbs /
rem install-autostart.bat for background operation.
rem ==================================================================
title SAP-ERP-Portal
cd /d "%~dp0.."
if not exist logs mkdir logs
rem Resolve node.exe - the SYSTEM account (autostart) may not have it on
rem PATH, so fall back to the standard install location.
set "NODEEXE=node"
where node >nul 2>&1
if %ERRORLEVEL% NEQ 0 (
if exist "%ProgramFiles%\nodejs\node.exe" set "NODEEXE=%ProgramFiles%\nodejs\node.exe"
)
:loop
echo [%date% %time%] starting server via "%NODEEXE%" >> logs\supervisor.log
"%NODEEXE%" server.js >> logs\server.log 2>&1
echo [%date% %time%] server exited with code %ERRORLEVEL% - restarting in 5s >> logs\supervisor.log
timeout /t 5 /nobreak >nul
goto loop