Shell脚本如下:

#/bin/bash
#environment variable
source /etc/profile
#disk space
for d in `df -P | grep /dev | awk '{print $5}' | sed 's/%//g'`
do
        if [ $d -gt 90 ];
                then
                msg="TIME:$(date +%F_%T)
                 HOSTNAME:$(hostname)
                 IPADDR:$(ifconfig |awk 'NR==2{print $2}')
                 MSG:硬盘使用过高!"
            echo $msg
        df -h > /test/tt.txt
        /test/pymail.py $msg
        fi
done


Logo

更多推荐