Wednesday, September 05, 2007

Linux Process and System Memory Info

FILENAME="/opt/apal3/SystemInfo/SystemInfo.txt"

PIDINDEX="4"
APAL3BIN="apal3_test3"

EXECUTION_DATE=`date +%Y%m%d%H%M%S`
echo $EXECUTION_DATE >> $FILENAME
echo "==============" >> $FILENAME

echo "System Mem Info : " >> $FILENAME
echo "==================" >> $FILENAME
cat /proc/meminfo >> $FILENAME
echo >> $FILENAME

echo "System Memory Info : " >> $FILENAME
echo "=====================" >> $FILENAME
free -mto >> $FILENAME
echo >> $FILENAME

echo "System Swap Info : " >> $FILENAME
echo "===================" >> $FILENAME
cat /proc/swaps >> $FILENAME
echo >> $FILENAME

echo "APAL5 Process Info : " >> $FILENAME
echo "====================" >> $FILENAME
APAL3_PID=`ps -ale | grep [" "]$APAL3BIN$ | tr -s " " | cut -f $PIDINDEX -d " "`
echo "APAL3_PID : "$APAL3_PID >> $FILENAME
cat /proc/$APAL3_PID/status >> $FILENAME
echo >> $FILENAME

echo "APAL5 Thread Info : " >> $FILENAME
echo "====================" >> $FILENAME
ps -eLf | grep $APAL3_PID >> $FILENAME
echo >> $FILENAME

echo "Kernel Message : " >> $FILENAME
echo "=================" >> $FILENAME
dmesg | grep -n kernel >> $FILENAME

echo "************************************************************" >> $FILENAME
echo >> $FILENAME

No comments: