Skip to content

Instantly share code, notes, and snippets.

@vMarkusK
Last active March 11, 2016 08:43
Show Gist options
  • Save vMarkusK/661004a26d5385ae0357 to your computer and use it in GitHub Desktop.
Save vMarkusK/661004a26d5385ae0357 to your computer and use it in GitHub Desktop.
HP Data Protector Syslog Integration
@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