diff --git a/Ping Logger/README-de.md b/Ping Logger/README-de.md new file mode 100644 index 0000000..dadcd8a --- /dev/null +++ b/Ping Logger/README-de.md @@ -0,0 +1,3 @@ +## Ping Logger +- ein Skript zum Protokollieren von Ping-Ergebnissen in einer txt-Datei, um Ping-Zeiten für ein Ping-Ziel über einen längeren Zeitraum ermitteln zu können. +- alles weitere, was eingestellt werden kann (z.B. Ping-Ziel, Wartezeit, Endzeit für den Skriptlauf, etc.) kann als Variable im Skript eingestellt werden. \ No newline at end of file diff --git a/Ping Logger/README-en.md b/Ping Logger/README-en.md new file mode 100644 index 0000000..542b3df --- /dev/null +++ b/Ping Logger/README-en.md @@ -0,0 +1,3 @@ +## Ping Logger +- a script for logging ping results in a txt file in order to be able to determine ping times for a ping target over a longer period of time. +- everything else that can be set (e.g. ping target, wait time, end time for the script run, etc.) can be set as variables in the script. \ No newline at end of file diff --git a/Ping Logger/README.md b/Ping Logger/README.md deleted file mode 100644 index 542b3df..0000000 --- a/Ping Logger/README.md +++ /dev/null @@ -1,3 +0,0 @@ -## Ping Logger -- a script for logging ping results in a txt file in order to be able to determine ping times for a ping target over a longer period of time. -- everything else that can be set (e.g. ping target, wait time, end time for the script run, etc.) can be set as variables in the script. \ No newline at end of file diff --git a/Ping Logger/README.md b/Ping Logger/README.md new file mode 120000 index 0000000..9e06398 --- /dev/null +++ b/Ping Logger/README.md @@ -0,0 +1 @@ +README-en.md \ No newline at end of file diff --git a/Ping Logger/ping_logger.bat b/Ping Logger/ping_logger-de.bat similarity index 94% rename from Ping Logger/ping_logger.bat rename to Ping Logger/ping_logger-de.bat index 5c5999c..63a87f8 100644 --- a/Ping Logger/ping_logger.bat +++ b/Ping Logger/ping_logger-de.bat @@ -1,45 +1,45 @@ -@echo off -setlocal enabledelayedexpansion - -REM destination address for the ping -set target=192.168.178.1 - -REM log file -set logfile=%target%-ping_log.txt - -REM Waiting time in seconds -set waittime=1 - -REM End time (in format HH:MM), leave blank for infinite running -set endtime= - -REM Current time -for /f "tokens=1-2 delims=:" %%a in ("%time%") do set currenttime=%%a:%%b - -REM Set the beginning of the log file -echo -------------------------------------------------- -echo !date! !time! - Starte Ping_Logger für Target: %target% -echo -------------------------------------------------- -echo -------------------------------------------------- >> %logfile% -echo !date! !time! - Starte Ping_Logger für Target: %target% >> %logfile% -echo -------------------------------------------------- >> %logfile% - -REM ping loop -:pingloop -for /f "tokens=1-2 delims=:" %%a in ("%time%") do set currenttime=%%a:%%b -if defined endtime if "!currenttime!" geq "%endtime%" goto end - -REM Ping command and logging the result -for /f "tokens=4-5 delims= " %%a in ('ping -n 1 %target% ^| find "Zeit="') do ( - set pingtime=%%b - echo !date! !time! - %target% ist erreichbar - !pingtime! - echo !date! !time! - %target% ist erreichbar - !pingtime! >> %logfile% -) - -REM waiting time -timeout /t %waittime% >nul - -goto pingloop - -:end -echo Ping script terminated. +@echo off +setlocal enabledelayedexpansion + +REM destination address for the ping +set target=192.168.178.1 + +REM log file +set logfile=%target%-ping_log.txt + +REM Waiting time in seconds +set waittime=1 + +REM End time (in format HH:MM), leave blank for infinite running +set endtime= + +REM Current time +for /f "tokens=1-2 delims=:" %%a in ("%time%") do set currenttime=%%a:%%b + +REM Set the beginning of the log file +echo -------------------------------------------------- +echo !date! !time! - Starte Ping_Logger für Target: %target% +echo -------------------------------------------------- +echo -------------------------------------------------- >> %logfile% +echo !date! !time! - Starte Ping_Logger für Target: %target% >> %logfile% +echo -------------------------------------------------- >> %logfile% + +REM ping loop +:pingloop +for /f "tokens=1-2 delims=:" %%a in ("%time%") do set currenttime=%%a:%%b +if defined endtime if "!currenttime!" geq "%endtime%" goto end + +REM Ping command and logging the result +for /f "tokens=4-5 delims= " %%a in ('ping -n 1 %target% ^| find "Zeit="') do ( + set pingtime=%%b + echo !date! !time! - %target% ist erreichbar - !pingtime! + echo !date! !time! - %target% ist erreichbar - !pingtime! >> %logfile% +) + +REM waiting time +timeout /t %waittime% >nul + +goto pingloop + +:end +echo Ping-Script beendet. diff --git a/Ping Logger/ping_logger-en.bat b/Ping Logger/ping_logger-en.bat new file mode 100644 index 0000000..1d0b3d9 --- /dev/null +++ b/Ping Logger/ping_logger-en.bat @@ -0,0 +1,45 @@ +@echo off +setlocal enabledelayedexpansion + +REM destination address for the ping +set target=192.168.178.1 + +REM log file +set logfile=%target%-ping_log.txt + +REM Waiting time in seconds +set waittime=1 + +REM End time (in format HH:MM), leave blank for infinite running +set endtime= + +REM Current time +for /f "tokens=1-2 delims=:" %%a in ("%time%") do set currenttime=%%a:%%b + +REM Set the beginning of the log file +echo -------------------------------------------------- +echo !date! !time! - Start Ping_Logger for Target: %target% +echo -------------------------------------------------- +echo -------------------------------------------------- >> %logfile% +echo !date! !time! - Start Ping_Logger for Target: %target% >> %logfile% +echo -------------------------------------------------- >> %logfile% + +REM ping loop +:pingloop +for /f "tokens=1-2 delims=:" %%a in ("%time%") do set currenttime=%%a:%%b +if defined endtime if "!currenttime!" geq "%endtime%" goto end + +REM Ping command and logging the result +for /f "tokens=4-5 delims= " %%a in ('ping -n 1 %target% ^| find "time="') do ( + set pingtime=%%b + echo !date! !time! - %target% is reachable - !pingtime! + echo !date! !time! - %target% is reachable - !pingtime! >> %logfile% +) + +REM waiting time +timeout /t %waittime% >nul + +goto pingloop + +:end +echo Ping script terminated.