Skip to content

Instantly share code, notes, and snippets.

@maravedi
Last active May 4, 2016 16:27
Show Gist options
  • Save maravedi/233157bf4456fcda075cf3d621261cbb to your computer and use it in GitHub Desktop.
Save maravedi/233157bf4456fcda075cf3d621261cbb to your computer and use it in GitHub Desktop.
@ECHO OFF
rem ### Validation for second parameter - Must be numeric ###
SET "var="&FOR /f "delims=0123456789" %%i in ("%2") DO SET var=%%i
IF DEFINED var (
echo.
echo The second parameter must be numeric
echo.
goto:eof
)
IF [%1] == [] goto :help
IF [%1] == [help] goto :help
IF [%1] == [-h] goto :help
IF [%1] == [--help] goto :help
IF [%2] == [] goto :help
IF [%3] == [] (
set arg3=30
) ELSE (
set arg3=%3
)
set arg1=%1
set arg2=%2
for /l %%x in (1, 1, %arg2%) do (
echo.
echo Iteration %%x - Script started: %DATE% %TIME%
echo ===========================================================================
qfarm /app | find /i "%arg1%"
sleep %arg3%
)
goto :eof
:help
echo.
echo Description:
echo.
echo A batch wrapper for the qfarm command.
echo.
echo Syntax:
echo.
echo "CheckXenAppServerLoad.cmd PWHC 100"
echo.
echo Parameters:
echo.
echo Parameter 1 is the search term
echo Parameter 2 is the number of times to re-run the qfarm command
echo Parameter 3 (Optional) is the delay between iteratons (in seconds)
echo.
echo Options:
echo.
echo -h, help, --help View this help screen
echo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment