[Linux监控]磁盘空间大小

echo 192.168.10.69>>ip.list
-------------------------------------------
#!/bin/bash
#注意if和[]之间的空格
rm -f ~/fanr/shell/DiskUsageAlert/out.print
out=$(cat ~/fanr/shell/DiskUsageAlert/ip.list) echo $out
for _IP in $out
do
ssh root@$_IP df | grep -vE "none|devfs"|awk '{if(NR>=2 && int($5)>100) print "'$_IP'" ":disk at " $6 " usage is "$5 " large than 90%" }' >> ~/fanr/shell/DiskUsageAlert/out.print done print=$(cat ~/fanr/shell/DiskUsageAlert/out.print) echo $print
if [ "$print" != "" ]
#if[ -s "~/fanr/shell/DiskUsageAlert/out.print" ]
then
echo
#echo $print| mail -s"Disk Usage Alerter" fai@tgn.com
fi
--------------------------------------------------------------------------------------
crontab DiskUsageAlert.crontab
cat DiskUsageAlert.crontab
#每5分钟运行一次
*/ * * * * sh /root/fanr/shell/DiskUsageAlert/DiskUsageAlter.sh
参考:
http://liguxk.blog.51cto.com/129038/123555 linux 自动执行 crontab学习笔记
上一篇:Skyfree的毕业论文 《系统封装与部署的深入研究》


下一篇:[洛谷1681]最大正方形II