Shell脚本监控Linux系统硬盘各分区使用率

前端之家收集整理的这篇文章主要介绍了Shell脚本监控Linux系统硬盘各分区使用率前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Shell脚本如下:

@H_403_5@#/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
原文链接:https://www.f2er.com/bash/392268.html

猜你在找的Bash相关文章