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
本文介绍了一个Shell脚本,用于通过top命令获取系统进程信息,并保存到指定文件中。此外,脚本还收集了特定Java进程的文件描述符信息。此脚本适用于系统监控场景,有助于理解系统资源使用情况。

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



