1 启动操作记录命令,记录下所有操作及输出结果
#script /perf-mon-config.log
2 创建性能监测脚本文件/perfmon.sh
#vi perfmon.sh
date >> /DH_pw450_perf_`hostname`_`date +%m%d`.log
echo "this is iostat's output" >>/DH_pw450_perf_`hostname`_`date +%m%d`.log
iostat -xnp 2 5 >> /DH_pw450_perf_`hostname`_`date +%m%d`.log
echo "this is mpstat's output" >>/DH_pw450_perf_`hostname`_`date +%m%d`.log
mpstat 2 5 >> /DH_pw450_perf_`hostname`_`date +%m%d`.log
echo "this is vmstat's output" >>/DH_pw450_perf_`hostname`_`date +%m%d`.log
vmstat 2 5 >> /DH_pw450_perf_`hostname`_`date +%m%d`.log
3 改变文件属性
#chmod 777 /perfmon.sh
4 编辑root用户的crontab文件
#cd /var/spool/cron/crontabs
#vi root
增加以下一行
30 * * * * /perfmon.sh
5 重启cron进程
#/etc/rc2.d/S75cron stop
#/etc/rc2.d/S75cron start
#crontab -l root
4 结束操作记录命令
#exit