Created
February 13, 2015 07:09
-
-
Save macdylan/55500f05c66c6b122002 to your computer and use it in GitHub Desktop.
windows daemon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
set task=programname | |
set srv=z:/path/programname.exe | |
set srv_dir=z:/path | |
set pwd=%CD% | |
:CHECK | |
for /f "tokens=5" %%n in ('qprocess.exe ^| find "%task%"') do ( | |
if %%~nn==%task% (goto ALIVE) else (goto START) | |
) | |
:START | |
echo [%time%] restarting ... | |
cd %srv_dir% | |
start %srv% | |
cd %pwd% | |
ping.exe /n 5 127.0.0.1 > nul | |
goto CHECK | |
:ALIVE | |
echo [%time%] process is alive, keep going ... | |
ping.exe /n 10 127.0.0.1 > nul |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment