http://unixskylab.wordpress.com/2009/01/05/my-favorite-aix-top-resource-consuming-commands/
I figure its a rather useful little script to keep handy... so here is a quick reproduction but I don't have an AIX machine at home so its 50-50 that the AIX version will work off the bat... And after a couple of tweeks its ready and tested for ubuntu...
For AIX (untested)
while [ 1 ]; do
DATE=`date "+%Y%m%d"`
LOG=cpu_mem.log.$DATE
if [ 1 ]; then
echo;
date;
ps aux | head -1;
echo "TOP MEM";
ps aux | sort -rn +3 | head;
echo "TOP CPU";
ps aux | sort -rn +2 | head -10;
sleep 10;
fi | tee -a $LOG
done
For Unbuntu
while [ 1 ]; do
DATE=`date "+%Y%m%d"`
LOG=cpu_mem.log.$DATE
if [ 1 ]; then
echo;
date;
ps aux | head -1;
echo "TOP MEM";
ps aux | sort -rnk4 | head;
echo "TOP CPU";
ps aux | sort -rnk3 | head -10;
sleep 10;
fi | tee -a $LOG
done
No comments:
Post a Comment