Skip to content

Commit c39bc07

Browse files
superhj1987oldratlee
authored andcommitted
refactor show-cpu-and-memory.sh: fix check pid
1 parent 9da3ba8 commit c39bc07

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

show-cpu-and-memory.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
for i in `ps -ef | egrep -v "awk|$0" | awk '/'$1'/{print $2}'`
1111
do
12+
# not pid
13+
if [[ $i == *[!0-9]* ]]; then
14+
continue
15+
fi
16+
1217
mem=`cat /proc/$i/status 2> /dev/null | grep VmRSS | awk '{print $2" " $3}'`
1318
cpu=`top -n 1 -b | awk '$1=='$i'{print $9}'`
1419

0 commit comments

Comments
 (0)