getWLS_NUP.sh 3.5 KB

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