| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- @echo off
- REM /**********************************************************************/
- REM * countclients.cmd *
- REM * - file to count Tuxedo client connections on a windows platform *
- REM * *
- REM **********************************************************************/
- @echo off
- setlocal
- setlocal EnableDelayedExpansion
- :: check to see if Collection is running, if it is, don't print the license prompt again
- tasklist /v | findstr /C:"Collection Tool"
- echo er %errorlevel%
- if errorlevel 1 (
- goto printLicense
- ) else (
- goto getTUXDIR
- )
- :printLicense
- more ..\resources\util\license_agreement.txt
- :promptloop
- set /p ANSWER=Accept License Agreement? (y\n\q)
-
- if "%ANSWER%" == "y" (
- goto getTUXDIR
- ) else if "%ANSWER%" == "n" (
- goto licagreement
- ) else if "%ANSWER%" == "q" (
- goto licagreement
- ) else (
- goto promptloop
- )
-
- :licagreement
- echo.
- echo You cannot run this program without agreeing to the license agreement.
- goto endcountclients
- :getTUXDIR
- if "%TUXDIR%" == "q" (
- echo User chose to quit countclients.>> %CT_TMP%\%COMPUTERNAME%-countclients.txt
- goto endcountclients
- ) else if "%TUXDIR%" == "quit" (
- echo User chose to quit countclients.>> %CT_TMP%\%COMPUTERNAME%-countclients.txt
- goto endcountclients
- ) else if not exist "%TUXDIR%\udataobj" (
- echo "TUXDIR not set or Tuxedo directory %TUXDIR%\udataobj does not exist."
- echo "Please enter the location where Tuxedo is installed to set TUXDIR environment variable,"
- set /p TUXDIR=or to quit the Tuxedo Countclients script, enter [quit or q]:
- goto getTUXDIR
- )
- REM SETLOCAL
- :getTUXCONFIG
- if "%TUXCONFIG%" == "q" (
- echo User chose to quit countclients.>> %CT_TMP%\%COMPUTERNAME%-countclients.txt
- goto endcountclients
- ) else if "%TUXCONFIG%" == "quit" (
- echo User chose to quit countclients.>> %CT_TMP%\%COMPUTERNAME%-countclients.txt
- goto endcountclients
- ) else if "%TUXCONFIG%" == "Q" (
- echo User chose to quit countclients.>> %CT_TMP%\%COMPUTERNAME%-countclients.txt
- goto endcountclients
- ) else if not exist "%TUXCONFIG%" (
- echo "Cannot find Tuxedo configuration file %TUXCONFIG%."
- set /p TUXCONFIG=Please try again to enter the location where Tuxedo TUXCONFIG file is located or type quit or q to exit countclients:
- goto getTUXCONFIG
- )
- @echo off
- :: init variables
- set SCRIPT_VERSION=19.1
- set PATH=%PATH%;%TUXDIR%\bin
- tasklist /v | findstr /C:"BBL" >> %CT_TMP%\%COMPUTERNAME%-countclients.txt
- echo er %errorlevel%
- if errorlevel 1 (
- goto BBLnotFound
- ) else (
- goto checkArguments
- )
- :checkArguments
- set FLDTBLDIR32=%TUXDIR%\udataobj
- set FIELDTBLS32=tpadm,Usysfl32
- if not EXIST %FLDTBLDIR32%\nul goto tuxdir_invalid
- REM
- REM /* set up some vars to be used as a LF/CR for the
- REM ud32 command */
- REM
- set LF=^
- REM
- REM /* put data for ud32 to act on in a temp file. */
- REM
- echo SRVCNM^ .TMIB^%LF%%LF%TA_OPERATION^ GET^%LF%%LF%TA_CLASS^ T_MACHINE^%LF%%LF%TA_FLAGS^ 65536^%LF%%LF%TA_FILTER^ 33560667^%LF%%LF%TA_FILTER^ 33560712^%LF%%LF%>temp.txt
- REM
- REM /* output the text file to the ud32 command to find client count*/
- REM
- type temp.txt|ud32 -C tpsysadm >>%CT_TMP%\%COMPUTERNAME%-countclients.txt
- del temp.txt
- tmunloadcf >> %CT_TMP%\%COMPUTERNAME%-countclients.txt
- goto endcountclients
- :BBLnotFound
- echo "No Tuxedo BBL processes found running on this machine. Countclients will not be run."
- echo "No Tuxedo BBL processes found running on this machine. Countclients will not be run." >> %CT_TMP%\%COMPUTERNAME%-countclients.txt
- :endcountclients
- @endlocal
- ENDLOCAL
|