diff --git a/integration-test/script/jboss_pid.sh b/integration-test/script/jboss_pid.sh index 81b85b68..7ab1f494 100755 --- a/integration-test/script/jboss_pid.sh +++ b/integration-test/script/jboss_pid.sh @@ -1,2 +1,19 @@ -#!/bin/bash -pgrep -f 'Main|jboss-modules.jar' | tr -d '\n' \ No newline at end of file +#!/bin/sh + +TARGET_PATTERN='Main|jboss-modules.jar' + +for pid_dir in /proc/*; do + if [ -d "$pid_dir" ] && ! [ -z "$(echo "$pid_dir" | sed 's|/proc/||' | grep -E '^[0-9]+$')" ]; then + PID=$(echo "$pid_dir" | sed 's|/proc/||') + CMDLINE_FILE="$pid_dir/cmdline" + if [ -r "$CMDLINE_FILE" ]; then + FULL_CMD=$(sed 's/\x0/ /g' "$CMDLINE_FILE") + if [ -z "$FULL_CMD" ]; then + continue + fi + if echo "$FULL_CMD" | grep -E -q "$TARGET_PATTERN"; then + echo $PID + fi + fi + fi +done \ No newline at end of file