web-3/wildfly/bin/jdr.sh

82 lines
2.2 KiB
Bash
Raw Permalink Normal View History

2024-11-26 02:32:07 +03:00
#!/bin/sh
#
# Copyright The WildFly Authors
# SPDX-License-Identifier: Apache-2.0
#
# JBoss Diagnostic Reporter (JDR)
#
# This script creates a JDR report containing useful information for
# diagnosing problems with the application server. The report consists
# of a zip file containing log files, configuration, a list of all files
# in the distribution and, if available, runtime metrics.
#
DIRNAME=`dirname "$0"`
GREP="grep"
. "$DIRNAME/common.sh"
# OS specific support (must be 'true' or 'false').
cygwin=false;
if uname | grep --ignore-case --quiet "CYGWIN"; then
cygwin=true;
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$JBOSS_HOME" ] &&
JBOSS_HOME=`cygpath --unix "$JBOSS_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$JAVAC_JAR" ] &&
JAVAC_JAR=`cygpath --unix "$JAVAC_JAR"`
fi
# Setup JBOSS_HOME
RESOLVED_JBOSS_HOME=`cd "$DIRNAME/.."; pwd`
if [ "x$JBOSS_HOME" = "x" ]; then
# get the full path (without any relative bits)
JBOSS_HOME=$RESOLVED_JBOSS_HOME
else
SANITIZED_JBOSS_HOME=`cd "$JBOSS_HOME"; pwd`
if [ "$RESOLVED_JBOSS_HOME" != "$SANITIZED_JBOSS_HOME" ]; then
echo "WARNING JBOSS_HOME may be pointing to a different installation - unpredictable results may occur."
echo ""
fi
fi
export JBOSS_HOME
# Setup the JVM
if [ "x$JAVA" = "x" ]; then
if [ "x$JAVA_HOME" != "x" ]; then
JAVA="$JAVA_HOME/bin/java"
else
JAVA="java"
fi
fi
# Set default modular JVM options
setDefaultModularJvmOptions $JAVA_OPTS
JAVA_OPTS="$JAVA_OPTS $DEFAULT_MODULAR_JVM_OPTIONS"
if [ "x$JBOSS_MODULEPATH" = "x" ]; then
JBOSS_MODULEPATH="$JBOSS_HOME/modules"
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
JBOSS_HOME=`cygpath --path --windows "$JBOSS_HOME"`
JBOSS_MODULEPATH=`cygpath --path --windows "$JBOSS_MODULEPATH"`
fi
#JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=y"
eval \"$JAVA\" $JAVA_OPTS \
-Djboss.home.dir=\""$JBOSS_HOME"\" \
-jar \""$JBOSS_HOME"/jboss-modules.jar\" \
-mp \""${JBOSS_MODULEPATH}"\" \
org.jboss.as.jdr \
"$@"