Files
be.ems/misc/checkdisk.sh
2024-10-22 14:39:30 +08:00

10 lines
299 B
Bash
Executable File

#!/bin/bash
threshold=99 # 设置硬盘使用率的阈值
disk_usage=$(df -h | awk '$NF=="/"{print $(NF-1)}' | sed 's/%//') # 获取根目录的硬盘使用率
if [ $disk_usage -gt $threshold ]; then
echo "Disk usage is above $threshold%. Taking action..."
systemctl restart keepalived
fi