Hi,
I would like to Ping the site [LINK REMOVED] every 10 minutes and update a text file with the word "Live" in case of reply and "Down" in case of no reply with date and time.
If it's possible can someone guide me?
Is this possible to be done?
Moderator: DosItHelp
-
- Posts: 1
- Joined: 12 Mar 2019 04:29
Is this possible to be done?
Last edited by aGerman on 14 Mar 2019 07:17, edited 1 time in total.
Reason: hyperlink removed
Reason: hyperlink removed
Re: Is this possible to be done?
Code: Select all
@echo off &setlocal
set "logfile=pingstat.txt"
for /l %%i in () do (
>nul ping nonsense.com
if errorlevel 1 (
>"%logfile%" echo Down
) else (
>"%logfile%" echo Live
)
>nul timeout /t 600 /nobreak
)
Steffen
Re: Is this possible to be done?
Code: Select all
@echo off
setlocal EnableDelayedExpansion
set "reply[0]=Down" & set "reply[1]=Live"
(for /L %%i in () do (
ping nonsense.com >nul
call echo %%reply[!errorlevel!]%%
) > logfile.txt