一个通用shell脚本,用来收集一些常用的主机运行状态信息
#!/bin/bash
if [ -f ~/.bash_profile ];
then
. ~/.bash_profile
fi
pid=`pgrep -f platform`
echo `date "+%Y-%m-%d %H:%M:%S"`"-信息采集报告:" >> /temp/info.txt
echo " " >> /temp/info.txt
echo " " >> /temp/info.txt
echo "进程内存占用:" >> /temp/info.txt
ps -o 'pid,comm,args,pcpu,rsz,vsz,stime,user,uid' -p $pid >> /temp/info.txt
echo " " >> /temp/info.txt
echo " " >> /temp/info.txt
echo "进程线程数:" >> /temp/info.txt
ps -mp $pid -o THREAD,tid,time|wc >> /temp/info.txt
echo " " >> /temp/info.txt
echo " " >> /temp/info.txt
echo "网络链接数:" >> /temp/info.txt
netstat -na|grep 8480 | awk '/^tcp/ {++S[$NF]} END {for (a in S) print a, S[a]}' >> /temp/info.txt
echo " " >> /temp/info.txt
echo " " >> /temp/info.txt
echo "数据库链接数:" >> /temp/info.txt
netstat -na|grep 3306|wc -l >> /temp/info.txt
echo " " >> /temp/info.txt
echo " " >> /temp/info.txt
echo "线程堆栈信息:" >> /temp/info.txt
jstack $pid >> /temp/info.txt
echo " " >> /temp/info.txt
echo " " >> /temp/info.txt
echo "文件句柄数信息:" >> /temp/info.txt
lsof -p $pid |wc -l >> /temp/info.txt
echo " " >> /temp/info.txt
echo " " >> /temp/info.txt
echo " " >> /temp/info.txt
echo " " >> /temp/info.txt
echo " " >> /temp/info.txt
echo " " >> /temp/info.txt
5 条评论
ae888ael1 · 2025-12-19 20:06
Just tried my luck at ae888ael1, and gotta say, the site’s slick! Easy to navigate, and the games loaded fast. Fingers crossed I hit the jackpot soon! Check ’em out here: ae888ael1
1338bets10con · 2025-12-24 10:48
Bets10, huh? Feels familiar. 1338bets10con… is this a new mirror site? Gotta be careful with these. Let’s see if it’s legit. Always good to double-check the source. What the hey, giving it a spin: 1338bets10con
phtaya06 · 2026-01-14 22:40
phtaya06 https://www.phtaya06y.com
okebet168 · 2026-01-15 02:41
okebet168 https://www.okebet168u.org
tayawin · 2026-01-15 03:52
tayawin https://www.tayawinch.net