mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-22 07:00:43 +08:00
fix: wildfly 36 fetch pid error
This commit is contained in:
@@ -1,2 +1,19 @@
|
||||
#!/bin/bash
|
||||
pgrep -f 'Main|jboss-modules.jar' | tr -d '\n'
|
||||
#!/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
|
||||
Reference in New Issue
Block a user