countclients.cmd 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. @echo off
  2. REM /**********************************************************************/
  3. REM * countclients.cmd *
  4. REM * - file to count Tuxedo client connections on a windows platform *
  5. REM * *
  6. REM **********************************************************************/
  7. @echo off
  8. setlocal
  9. setlocal EnableDelayedExpansion
  10. :: check to see if Collection is running, if it is, don't print the license prompt again
  11. tasklist /v | findstr /C:"Collection Tool"
  12. echo er %errorlevel%
  13. if errorlevel 1 (
  14. goto printLicense
  15. ) else (
  16. goto getTUXDIR
  17. )
  18. :printLicense
  19. more ..\resources\util\license_agreement.txt
  20. :promptloop
  21. set /p ANSWER=Accept License Agreement? (y\n\q)
  22. if "%ANSWER%" == "y" (
  23. goto getTUXDIR
  24. ) else if "%ANSWER%" == "n" (
  25. goto licagreement
  26. ) else if "%ANSWER%" == "q" (
  27. goto licagreement
  28. ) else (
  29. goto promptloop
  30. )
  31. :licagreement
  32. echo.
  33. echo You cannot run this program without agreeing to the license agreement.
  34. goto endcountclients
  35. :getTUXDIR
  36. if "%TUXDIR%" == "q" (
  37. echo User chose to quit countclients.>> %CT_TMP%\%COMPUTERNAME%-countclients.txt
  38. goto endcountclients
  39. ) else if "%TUXDIR%" == "quit" (
  40. echo User chose to quit countclients.>> %CT_TMP%\%COMPUTERNAME%-countclients.txt
  41. goto endcountclients
  42. ) else if not exist "%TUXDIR%\udataobj" (
  43. echo "TUXDIR not set or Tuxedo directory %TUXDIR%\udataobj does not exist."
  44. echo "Please enter the location where Tuxedo is installed to set TUXDIR environment variable,"
  45. set /p TUXDIR=or to quit the Tuxedo Countclients script, enter [quit or q]:
  46. goto getTUXDIR
  47. )
  48. REM SETLOCAL
  49. :getTUXCONFIG
  50. if "%TUXCONFIG%" == "q" (
  51. echo User chose to quit countclients.>> %CT_TMP%\%COMPUTERNAME%-countclients.txt
  52. goto endcountclients
  53. ) else if "%TUXCONFIG%" == "quit" (
  54. echo User chose to quit countclients.>> %CT_TMP%\%COMPUTERNAME%-countclients.txt
  55. goto endcountclients
  56. ) else if "%TUXCONFIG%" == "Q" (
  57. echo User chose to quit countclients.>> %CT_TMP%\%COMPUTERNAME%-countclients.txt
  58. goto endcountclients
  59. ) else if not exist "%TUXCONFIG%" (
  60. echo "Cannot find Tuxedo configuration file %TUXCONFIG%."
  61. set /p TUXCONFIG=Please try again to enter the location where Tuxedo TUXCONFIG file is located or type quit or q to exit countclients:
  62. goto getTUXCONFIG
  63. )
  64. @echo off
  65. :: init variables
  66. set SCRIPT_VERSION=19.1
  67. set PATH=%PATH%;%TUXDIR%\bin
  68. tasklist /v | findstr /C:"BBL" >> %CT_TMP%\%COMPUTERNAME%-countclients.txt
  69. echo er %errorlevel%
  70. if errorlevel 1 (
  71. goto BBLnotFound
  72. ) else (
  73. goto checkArguments
  74. )
  75. :checkArguments
  76. set FLDTBLDIR32=%TUXDIR%\udataobj
  77. set FIELDTBLS32=tpadm,Usysfl32
  78. if not EXIST %FLDTBLDIR32%\nul goto tuxdir_invalid
  79. REM
  80. REM /* set up some vars to be used as a LF/CR for the
  81. REM ud32 command */
  82. REM
  83. set LF=^
  84. REM
  85. REM /* put data for ud32 to act on in a temp file. */
  86. REM
  87. 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
  88. REM
  89. REM /* output the text file to the ud32 command to find client count*/
  90. REM
  91. type temp.txt|ud32 -C tpsysadm >>%CT_TMP%\%COMPUTERNAME%-countclients.txt
  92. del temp.txt
  93. tmunloadcf >> %CT_TMP%\%COMPUTERNAME%-countclients.txt
  94. goto endcountclients
  95. :BBLnotFound
  96. echo "No Tuxedo BBL processes found running on this machine. Countclients will not be run."
  97. echo "No Tuxedo BBL processes found running on this machine. Countclients will not be run." >> %CT_TMP%\%COMPUTERNAME%-countclients.txt
  98. :endcountclients
  99. @endlocal
  100. ENDLOCAL