我创建了一个 .sh 文件来监视 2 个文件路径并将磁盘大小发送给我。它运行,我没有收到邮件。文件系统 > 90%
#!/bin/bash
used=$(df -Ph | grep 'location1' | awk {'print $5'})
used1=$(df -Ph | grep '/location2' | awk {'print $5'})
max=80%
if [ ${used%?} -gt ${max%?} ]; then mail -s 'Disk space alert' abc@eee.com;bbb@eee.com << EOF
The Mount Point "location1" on $(hostname) has used $used at $(date);
if [ ${use1%?} -gt ${max%?} ]; then mail -s 'Disk space alert' abc@eee.com; bbb@eee.com << EOF
The Mount Point "location2" on $(hostname) has used $used1 at $(date);
EOF
fi