Jump to content

Recommended Posts

Posted

I have the following .bat file that I run at start up.

It SHOULD monitor LANRanger , restart it if its crashed/not running and report to a log file. ( I have tested it only by quitting lanranger it works) but i cant simulate a crash as they happen very infrequently but when they do no one can log on.

 

I have noticed that on both my servers the scrip runs fine. Then after a time the window has disappeared.

Any ideas?

 

echo[/mention] OFF

REM 1. Call DOS tasklist and extract the EXE (image) names and then FIND taskmgr.exe in that list.
REM    ** YOU DO NOT NEED TO SPECIFY THE FULL PATH/FILENAME OF THE EXE HERE.
tasklist /FI "IMAGENAME eq LanRanger.exe" 2>NUL | find /I /N "LanRanger.exe">NUL

REM 2. IF taskmgr.exe is running then just echo that it is running to the console app (you can remove this line if you prefer).
if "%ERRORLEVEL%"=="0" echo Lan Ranger is running


REM 3. IF taskmgr.exe is NOT running then start it.
REM    ** YOU MIGHT HAVE TO SPECIFY THE FULL PATH/FILENAME OF THE EXE HERE IN ORDER FOR IT TO START.
if %ERRORLEVEL% GEQ 1 @echo The Program Lan Ranger>> RANGERFAILLOG.txt
if %ERRORLEVEL% GEQ 1 @echo FAILED AT %TIME% , %DATE% >> RANGERFAILLOG.txt
if %ERRORLEVEL% GEQ 1 START "" "C:\Program Files (x86)\Ranger\LanRanger.exe"

REM 4. We now invoke PING against the local machine loopback IP (127.0.0.1) a few times to provide a simply delay mechanism between EXE checks.
PING 127.0.0.1 -n 15>NUL
REM 5. Repeat the process from the beginning.
CALL ProcessMonitor.bat

Posted
Does lanranger write anything to the eventlog when it falls over/closes? if so you could just use the Task Scheduler to listen for that event and send an email/start up the program. That's what i use for some services that sometimes stop randomly.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...