常用的进程计算脚本

#!/bin/bash
ps -C $1 -O rss | gawk '{ count ++; sum += $2 }; END {count --; print "Number of processes =",count; print "Memory usage per process =",sum/1024/count, "MB"; print "Total memory usage =", sum/1024, "MB" ;};'

 

参考上述脚本使用方法

[root@gd02-qa-plxt2-nodomain-web-95 bin]# ./mem.sh  php-fpm
Number of processes = 26
Memory usage per process = 21.1771 MB
Total memory usage = 550.605 MB

 


 

你可能感兴趣的:(脚本)