#!/bin/bash
while ; do vmr='vmstat | tail -l \ | awk '{print $1}' if [ ${vmr} -gt 4 ] R的阀值为4 then date >> /root/monitor.txt vmstat >> /root/monitor.txt netstat -anp >> /root/monitor.txt ps -aux >> /root/moitor.txt last >> /root/monitor.txt tail -10 /var/log/messages >> \ /root/monitor.txt fi sleep 60 done 此脚本可放至后台运行 sh /root/moitor.sh &
转载于:https://blog.51cto.com/ios2015/1136558