From 00149864b2885b71524ca8a2de06fa28f59bf32a Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Wed, 11 Jul 2018 19:29:00 +0200 Subject: [PATCH] Plugin minecraft-users-ram_: more precise netstat output filtering --- plugins/minecraft/minecraft-users-ram_ | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/minecraft/minecraft-users-ram_ b/plugins/minecraft/minecraft-users-ram_ index e3314151..7e1d18d6 100755 --- a/plugins/minecraft/minecraft-users-ram_ +++ b/plugins/minecraft/minecraft-users-ram_ @@ -47,8 +47,8 @@ then exit 0 fi -PLAYERCOUNT=$(netstat -tn | grep -i "$MC_PORT" | grep ESTABLISHED | wc -l) -MC_PID=$(netstat -tlpn | grep "$MC_PORT" | sed -n -e '1p' | awk '{ print $7 }' | cut -d '/' -f1) +PLAYERCOUNT=$(netstat -tn | grep ":$MC_PORT " | grep ESTABLISHED | wc -l) +MC_PID=$(netstat -tlpn | grep ":$MC_PORT " | sed -n -e '1p' | awk '{ print $7 }' | cut -d '/' -f1) if [ ! -z "${MC_PID}" ] then #is running MEMGiB=$(ps -p "$MC_PID" -o rss | sed -n '2p' | awk '{ print $1 / 1024 / 1024 }')