Skip to content

Instantly share code, notes, and snippets.

@thomo
Created January 18, 2017 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomo/e1d334765f26c41d580ad46734237b4b to your computer and use it in GitHub Desktop.
Save thomo/e1d334765f26c41d580ad46734237b4b to your computer and use it in GitHub Desktop.
cscript mit watchdog
@ECHO off
cd "D:\Daten\Skripte\"
start /min cmd /c watchdog.cmd
c:\Windows\SysWOW64\cscript.exe "D:\Daten\Skripte\Sync.vbs" %*
del watchdog_starttimestamp.ts 2> nul
@ECHO OFF
date /t > watchdog_starttimestamp.ts
time /t >> watchdog_starttimestamp.ts
set looptime=5
set timeout=600
REM ---------------------------------------------------
set count=0
:loop
timeout /T %looptime% > nul
set /A count+=%looptime%
for /f %%i in ('taskkill /FI "STATUS eq NOT RESPONDING" /IM cscript.exe /F') do Set result=%%i
IF not x%result:SUCCESS=%==x%result% (
echo "kill cscript"
goto ende
)
IF NOT EXIST "watchdog_starttimestamp.ts" (
echo "finish watchdog"
goto ende
)
IF %count% GEQ %timeout% (
echo "timeout"
goto ende
)
goto loop
:ende
del "watchdog_starttimestamp.ts" 2> nul
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment