jdr.sh 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/sh
  2. # JBoss Diagnostic Reporter (JDR)
  3. #
  4. # This script creates a JDR report containing useful information for
  5. # diagnosing problems with the application server. The report consists
  6. # of a zip file containing log files, configuration, a list of all files
  7. # in the distribution and, if available, runtime metrics.
  8. #
  9. DIRNAME=`dirname "$0"`
  10. # OS specific support (must be 'true' or 'false').
  11. cygwin=false;
  12. if [ `uname|grep -i CYGWIN` ]; then
  13. cygwin = true;
  14. fi
  15. # For Cygwin, ensure paths are in UNIX format before anything is touched
  16. if $cygwin ; then
  17. [ -n "$JBOSS_HOME" ] &&
  18. JBOSS_HOME=`cygpath --unix "$JBOSS_HOME"`
  19. [ -n "$JAVA_HOME" ] &&
  20. JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
  21. [ -n "$JAVAC_JAR" ] &&
  22. JAVAC_JAR=`cygpath --unix "$JAVAC_JAR"`
  23. fi
  24. # Setup JBOSS_HOME
  25. RESOLVED_JBOSS_HOME=`cd "$DIRNAME/.."; pwd`
  26. if [ "x$JBOSS_HOME" = "x" ]; then
  27. # get the full path (without any relative bits)
  28. JBOSS_HOME=$RESOLVED_JBOSS_HOME
  29. else
  30. SANITIZED_JBOSS_HOME=`cd "$JBOSS_HOME"; pwd`
  31. if [ "$RESOLVED_JBOSS_HOME" != "$SANITIZED_JBOSS_HOME" ]; then
  32. echo "WARNING JBOSS_HOME may be pointing to a different installation - unpredictable results may occur."
  33. echo ""
  34. fi
  35. fi
  36. export JBOSS_HOME
  37. # Setup the JVM
  38. if [ "x$JAVA" = "x" ]; then
  39. if [ "x$JAVA_HOME" != "x" ]; then
  40. JAVA="$JAVA_HOME/bin/java"
  41. else
  42. JAVA="java"
  43. fi
  44. fi
  45. if [ "x$JBOSS_MODULEPATH" = "x" ]; then
  46. JBOSS_MODULEPATH="$JBOSS_HOME/modules"
  47. fi
  48. # For Cygwin, switch paths to Windows format before running java
  49. if $cygwin; then
  50. JBOSS_HOME=`cygpath --path --windows "$JBOSS_HOME"`
  51. JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
  52. JBOSS_CLASSPATH=`cygpath --path --windows "$JBOSS_CLASSPATH"`
  53. JBOSS_ENDORSED_DIRS=`cygpath --path --windows "$JBOSS_ENDORSED_DIRS"`
  54. JBOSS_MODULEPATH=`cygpath --path --windows "$JBOSS_MODULEPATH"`
  55. fi
  56. eval \"$JAVA\" $JAVA_OPTS \
  57. -Djboss.home.dir=\"$JBOSS_HOME\" \
  58. -jar \"$JBOSS_HOME/jboss-modules.jar\" \
  59. -mp \"${JBOSS_MODULEPATH}\" \
  60. org.jboss.as.jdr \
  61. "$@"