1 Star 0 Fork 0

houmingzhang/mycommand

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
uk_monitor 607 Bytes
一键复制 编辑 原始数据 按行查看 历史
houmingzhang 提交于 2022-02-02 14:42 +08:00 . 脚本工具
#!/bin/bash
svr=UKing_LiveMTransServer
outputfilename=`date '+%Y%m%d%H%M%S'`.csv
echo "time,cpu,memory,fd" >> ${outputfilename}
ret=`ps -ef |grep -v grep|grep ${svr} |awk '{print $2}'`
echo ${ret}
SELECTPID=0
for pid in ${ret}
do
if [ "${SELECTPID}" -lt "${pid}" ];then
SELECTPID=${pid}
fi
done
echo "selectpid is ${SELECTPID}"
# 该脚本用于监控程序的内存,CPU和打开的文件数
while(true)
do
echo `date '+%Y-%m-%d %H:%M:%S'` "," `top -n 1 -p ${SELECTPID} | grep ${SELECTPID} | awk '{print $10","$11}'` "," `ls -l /proc/${SELECTPID}/fd/ | wc -l` >> ${outputfilename}
sleep 5
done
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/dtrylzhm/mycommand.git
git@gitee.com:dtrylzhm/mycommand.git
dtrylzhm
mycommand
mycommand
master

搜索帮助