Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
Move PID calculation after JPS check
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Pitidis committed Jun 13, 2014
1 parent 2a608cf commit 9b41802
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion jdump.sh
Expand Up @@ -84,7 +84,6 @@ TMP_PATH="$TMP_DIR/$APP_NAME"
JMAP="$(which jmap 2>/dev/null)"
JPS="$(which jps 2>/dev/null)"
JSTACK="$(which jstack 2>/dev/null)"
PID=$($JPS 2>/dev/null | grep -i "$APP_NAME" | awk '{print $1}')

[[ -n "$APP_NAME" ]] && {
print_usage
Expand All @@ -100,6 +99,7 @@ PID=$($JPS 2>/dev/null | grep -i "$APP_NAME" | awk '{print $1}')
[[ -z "$JSTACK" ]] &&
error "jstack not found. Ensure the JDK is installed and that the 'jstack' program is on the PATH."

PID=$($JPS 2>/dev/null | grep -i "$APP_NAME" | awk '{print $1}')
if [[ -z "$PID" ]]; then
# try again, as root
if [[ "$USER" != "root" ]]
Expand Down

0 comments on commit 9b41802

Please sign in to comment.