Created
July 18, 2012 11:52
-
-
Save agazso/3135760 to your computer and use it in GitHub Desktop.
WGet a page every minute and save it
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
SET URL=http://localhost:8080 | |
:START | |
SET CDATE=%DATE% | |
:: Remove trailing dot | |
SET CDATE=%CDATE:~,-1% | |
:: Replace colons with dots | |
SET CTIME=%TIME::=.% | |
:: Remove spaces | |
SET CTIME=%CTIME: =0% | |
:: Remove last three characters from time | |
SET CTIME=%CTIME:~0,-3% | |
SET TIMESTAMP=%CDATE%-%CTIME% | |
SET SECONDS=%CTIME:~-2% | |
wget --no-check-certificate -o output-%TIMESTAMP%.txt -O diag-%TIMESTAMP%.html %URL% | |
SET TIME_AFTER=%TIME:~0,-3% | |
SET SECONDS_AFTER=%TIME_AFTER:~-2% | |
ECHO %SECONDS_AFTER% | |
:: Handle overflow | |
IF %SECONDS_AFTER% GEQ %SECONDS% SET /A PING_TIMEOUT=60 - (%SECONDS_AFTER% - %SECONDS%) | |
IF %SECONDS_AFTER% LSS %SECONDS% SET /A PING_TIMEOUT=60 - (%SECONDS_AFTER% + 60 - %SECONDS) | |
ping -n %PING_TIMEOUT% 127.0.0.1 | |
GOTO START |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment