Automate restart mendix runtime Windows on Premise deployment

0
Hi We’ve got our own monitoring in place to monitor a windows environment running our Mendix website and would like to restart the runtime when things go balistic I would like some insight into using net stop [OurMendixService] or manual invocation of $APPDIR\Service\Mendix.Service.exe /app "$APPDIR"  in order to get that going Thanks
asked
1 answers
0

The following quick and dirty test script does accomplish the above, but the service console then fails to get back a handle on the service

@echo off
@rem ---------------------------------------------------------------------------
@rem Usrdata
@rem ---------------------------------------------------------------------------
set SVCNAM=OurService
set PROCJAV=javaw.exe
set PROCSVC=Mendix.Service.exe
set INTERV=1
@rem ---------------------------------------------------------------------------
@rem Main
@rem ---------------------------------------------------------------------------
goto monitor
@rem ----------------------------------------------------------------------------
@rem Monitor Loop
@rem ----------------------------------------------------------------------------
:monitor
	call :prgcheck
	timeout /t %INTERV% >NUL
	goto monitor
@rem ----------------------------------------------------------------------------
@rem Check Processes
@rem ----------------------------------------------------------------------------
:prgcheck
	tasklist /FI "IMAGENAME eq %PRGNAM%" 2>NUL | find /I /N "%PRGNAM%">NUL
	if "%ERRORLEVEL%"=="0" (
		echo %time%: Mendix Running 
	) else (
		echo %time%: Mendix Not Running : Restarting...
		@rem -----------------------------------------------------------------------------
		@rem Kill
		@rem -----------------------------------------------------------------------------
		taskkill /f /im %PROCSVC% > nul 2>&1
		taskkill /f /im %PROCJAV% > nul 2>&1
		@rem -----------------------------------------------------------------------------
		@rem Start
		@rem -----------------------------------------------------------------------------
		net start %SVCNAM%
	)

 

answered