top
lsof
/proc/*/fd
#!/bin/bash
time=`date +%Y%m%d%H%M%S`
file1=$1.$time
file2=$2.$time
if [[ -f $file1 ]]
then
head="boom boom boom"
else
touch $file1
fi
if [[ -f $file2 ]]
then
head="boom boom boom"
else
touch $file2
fi
top -b -n 1 >> $file1
pids=`ps ax | grep resin | grep java | awk -F' ' '{print $1}'`
for i in $pids
do
ls -all /proc/$i/fd/ >> $file2
done
exit 0
本文介绍了一个简单的Bash脚本,用于收集系统资源使用情况及特定进程的文件描述符信息。通过运行此脚本,可以将top命令输出的系统资源使用快照以及所有包含“java”关键字的进程所打开的文件列表记录到两个指定的文件中。
1493

被折叠的 条评论
为什么被折叠?



