Last active
March 11, 2016 08:43
-
-
Save vMarkusK/661004a26d5385ae0357 to your computer and use it in GitHub Desktop.
HP Data Protector Syslog Integration
This file contains hidden or 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 | |
setlocal | |
:: global variables | |
set log=D:\syslog\sessions.log | |
set maxbytesize=1000 | |
:: cleanup logic | |
IF NOT EXIST "%log%" GOTO :Write | |
FOR /F "usebackq" %%A IN ('%log%') DO set size=%%~zA | |
if %size% LSS %maxbytesize% ( | |
echo is ^< %maxbytesize% bytes | |
) ELSE ( | |
echo is ^>= %maxbytesize% bytes | |
del %log% | |
) | |
:Write | |
:: write stdout to a log file | |
for /F "tokens=*" %%a in ('more') do ( | |
echo %%a >> %log% | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment