wls-basic-measurement.sh 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. #!/bin/sh
  2. SCRIPT_VERSION="19.1($CT_BUILD_VERSION)"
  3. SCRIPT_NAME=${0}
  4. ##########################################################################################
  5. ## wls-basic-measurement v 19.1
  6. ## - Invoke WLS Basic feature usage script. Connects to a running WLS server and
  7. ## returns WLS Basic feature usage information.
  8. ##
  9. ## EXAMPLES
  10. ## $ wls-basic-measurement
  11. ##
  12. ##############################################################
  13. # make echo more portable
  14. #
  15. echo_Basic_printer() {
  16. #IFS=" " command
  17. eval 'printf "%b\n" "$*"'
  18. }
  19. ##############################################################
  20. # make echo more portable
  21. #
  22. echo_basic_log() {
  23. $ECHO_BASIC_PRINTER "$1"
  24. $ECHO_BASIC_PRINTER "$1" >> $2
  25. }
  26. # set up $ECHO
  27. ECHO_BASIC_PRINTER="echo_Basic_printer"
  28. ################################################################################
  29. #
  30. # output welcome message.
  31. #
  32. beginMsg()
  33. {
  34. cat license_agreement.txt | more
  35. ANSWER=
  36. $ECHO_BASIC_PRINTER "Accept License Agreement? "
  37. while [ -z "${ANSWER}" ]
  38. do
  39. $ECHO_BASIC_PRINTER "$1 [y/n/q]: \c" >&2
  40. read ANSWER
  41. #
  42. # Act according to the user's response.
  43. #
  44. case "${ANSWER}" in
  45. Y|y)
  46. return 0 # TRUE
  47. ;;
  48. N|n|Q|q)
  49. exit 1 # FALSE
  50. ;;
  51. #
  52. # An invalid choice was entered, reprompt.
  53. #
  54. *) ANSWER=
  55. ;;
  56. esac
  57. done
  58. }
  59. ################################################################################
  60. #
  61. #*********************************** MAIN **************************************
  62. #
  63. ################################################################################
  64. # command line defaults
  65. SCRIPT_OPTIONS=
  66. STANDALONE=
  67. # check to see if Collection is running, if not then print license. also skip ECHO setup
  68. ps -eaf | grep Collection*.sh | grep -v grep >/dev/null 2>&1
  69. if [ $? -eq 0 ] ; then
  70. STANDALONE="false"
  71. else
  72. STANDALONE="true"
  73. fi
  74. if [ "${STANDALONE}" = "true" ] ; then
  75. # print welcome message
  76. beginMsg
  77. fi
  78. if [ "${LICAGREE}" = "YES" ] ; then
  79. exit 1
  80. fi
  81. PYFILE=../resources/util/WLST/WLSBasic/wls-basic-measurement.py
  82. COMPARE_RESULT_FILE=compare_result.txt
  83. WLS_COLLECTED=$CT_TMP/logs/WLS_collected.log
  84. WLS_WARNINGS=$CT_TMP/logs/WLS_warnings.log
  85. WLS_ERRORS=$CT_TMP/logs/WLS_errors.log
  86. QUIT_WLST=
  87. if [ -f $COMPARE_RESULT_FILE ]
  88. then
  89. QUIT_WLST=`cat $COMPARE_RESULT_FILE| grep QUIT_WLST | sed -e 's/QUIT_WLST=//g'`
  90. fi
  91. while [ -z "${MW_HOME}" -a -z "${QUIT_WLST}" ]
  92. do
  93. if [ -z "${MW_HOME}" ] ; then
  94. $ECHO_BASIC_PRINTER "Please enter the MW_HOME location where WebLogic is installed">&2
  95. $ECHO_BASIC_PRINTER "or to quit the WebLogic Basic script, enter [quit or q]: \n" >&2
  96. read MW_HOME
  97. fi
  98. if [ "${MW_HOME}" = "q" -o "${MW_HOME}" = "quit" -o "${MW_HOME}" = "Q" ]; then
  99. QUIT_WLST="yes"
  100. echo QUIT_WLST="yes" > $COMPARE_RESULT_FILE
  101. elif [ ! -f "${MW_HOME}/oracle_common/common/bin/wlst.sh" ]; then
  102. $ECHO_BASIC_PRINTER "\nWebLogic WLST script, wlst.sh not found in ${MW_HOME}/oracle_common/common/bin/wlst.sh .\nPlease try again.\n"
  103. MW_HOME=
  104. fi
  105. done
  106. if [ "${QUIT_WLST}" = "yes" ]; then
  107. rmdir $CT_TMP/WLSBasic 2>/dev/null
  108. echo_basic_log "CT: WLS-03001: WARNING: User chose to quit WL Basic measurement script." $WLS_WARNINGS
  109. else
  110. if [ -f $MW_HOME/wlserver/server/bin/setWLSEnv.sh ]; then
  111. . "$MW_HOME/wlserver/server/bin/setWLSEnv.sh"
  112. elif [ -f $MW_HOME/wlserver_10.3/server/bin/setWLSEnv.sh ]; then
  113. . "$MW_HOME/wlserver_10.3/server/bin/setWLSEnv.sh"
  114. fi
  115. if [ ! -d $CT_TMP/WLSBasic ] ; then
  116. mkdir -p $CT_TMP/WLSBasic
  117. fi
  118. WLST_MACHINE_NAME=`uname -n`
  119. $MW_HOME/oracle_common/common/bin/wlst.sh ${PYFILE} ${WLST_MACHINE_NAME}
  120. fi