Use grep instead of cut

This commit is contained in:
Natenom 2013-05-08 17:37:04 +02:00
parent 720991f37d
commit edcae39f28
1 changed files with 1 additions and 2 deletions

View File

@ -18,8 +18,7 @@ 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)
if [ ! -z "${MC_PID}" ]
then #is running
MEMORYRSS=$(ps -p ${MC_PID} -o rss | cut -d'
' -f2)
MEMORYRSS=$(ps -p ${MC_PID} -o rss | grep -v RSS)
MEMGiB=$(echo "scale=2;${MEMORYRSS}/1024/1024" | bc -l)
else
MEMGiB=0