Shell脚本监控Linux系统硬盘各分区使用率
Shell脚本如下:#/bin/bash#disk spacefor d in `df -P | grep /dev | awk '{print $5}' | sed 's/%//g'`doif [ $d -gt 20 ];thenmsg="TIME:$(date +%F_%T)
·
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
更多推荐
已为社区贡献2条内容
所有评论(0)