首页 > 代码库 > centos监视文件系统脚本

centos监视文件系统脚本

vi /root/dfmon.sh

#!/bin/bash#AUTHOR:kiki#DATE:20141115#PURPOSE:be used to monitor file system.fsvalue=80dfwork="/tmp/dfwork">$dfworkdf |tail -n +2 |awk {print $1,$5,$6}|grep -v "/dev/sr[0-9]" >$dfworkwhile read fsdev fspct fssysdofspct=`echo $fspct|sed s/\%//g`    if [ $fspct -gt $fsvalue ]    then       echo "$fsdev mounted on $fssys is $fspct%" |mail root    fidone < $dfwork

chmod +x /root/dfmon.sh

echo ‘15 * * * * /root/dfmon.sh 2>&1‘ > /root/dfmon.cron

crontab /root/dfmon.cron

centos监视文件系统脚本