FreeBSD Periodic 系统简介
最后更新于
daily_backup_passwd_enable="YES"daily_output=/var/log/daily.log
weekly_output=/var/log/weekly.log
monthly_output=/var/log/monthly.log#!/bin/sh
if [ -r /etc/defaults/periodic.conf ]
then
. /etc/defaults/periodic.conf
source_periodic_confs
fi
: ${zfs_pool_usage_enable:="YES"}
: ${zfs_pool_usage_threshold:=80}
[ "$zfs_pool_usage_enable" = "YES" ] || exit 0
echo ""
echo "Checking ZFS pool usage (threshold: ${zfs_pool_usage_threshold}%)..."
zpool list -H -o name,capacity | while read -r pool usage; do
percent=${usage%%%} # 移除 '%' 符号
if [ "${percent}" -ge "${zfs_pool_usage_threshold}" ]; then
echo "WARNING: ZFS pool '${pool}' is ${percent}% full!"
else
echo "OK: ZFS pool '${pool}' is below capacity threshold (${percent}%)."
fi
done
exit 0chmod +x /etc/periodic/daily/405.zfs_pool_usagedaily_show_success="YES"
zfs_pool_usage_enable="YES"
zfs_pool_usage_threshold="75"periodic dailyChecking ZFS pool usage (threshold: 75%)...
OK: ZFS pool 'data' is below capacity threshold (6%).
OK: ZFS pool 'zroot' is below capacity threshold (27%).