diff options
author | netchild <netchild@FreeBSD.org> | 2011-05-04 12:37:10 +0000 |
---|---|---|
committer | netchild <netchild@FreeBSD.org> | 2011-05-04 12:37:10 +0000 |
commit | 579e9f977b62dfe399809418ba51b99bb8710af5 (patch) | |
tree | 8efe8ab1faf16a14d19d8c2b09370e5753211c6a /etc | |
parent | f5e93cef6567c87646c62f56af13f3a7d9303f50 (diff) | |
download | FreeBSD-src-579e9f977b62dfe399809418ba51b99bb8710af5.zip FreeBSD-src-579e9f977b62dfe399809418ba51b99bb8710af5.tar.gz |
Use proper return codes (valuable output, invalid config, problems).
MFC after: 1 week
Diffstat (limited to 'etc')
-rwxr-xr-x | etc/periodic/daily/800.scrub-zfs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/etc/periodic/daily/800.scrub-zfs b/etc/periodic/daily/800.scrub-zfs index de139c2..7ad99fe 100755 --- a/etc/periodic/daily/800.scrub-zfs +++ b/etc/periodic/daily/800.scrub-zfs @@ -26,10 +26,12 @@ case "$daily_scrub_zfs_enable" in daily_scrub_zfs_pools="$(zpool list -H -o name)" fi + rc=0 for pool in ${daily_scrub_zfs_pools}; do # sanity check _status=$(zpool list "${pool}" 2> /dev/null) if [ $? -ne 0 ]; then + rc=2 echo " WARNING: pool '${pool}' specified in" echo " '/etc/periodic.conf:daily_scrub_zfs_pools'" echo " does not exist" @@ -38,13 +40,11 @@ case "$daily_scrub_zfs_enable" in _status=${_status##*$newline} case ${_status} in *FAULTED*) + rc=3 echo "Skipping faulted pool: ${pool}" continue ;; esac - # successful only if there is at least one pool to scrub - rc=0 - # determine how many days shall be between scrubs eval _pool_threshold=\${daily_scrub_zfs_${pool}_threshold} if [ -z "${_pool_threshold}" ];then @@ -77,10 +77,12 @@ case "$daily_scrub_zfs_enable" in *"none requested"*) echo " starting first scrub (since reboot) of pool '${pool}':" zpool scrub ${pool} + [ $rc -eq 0 ] && rc=1 ;; *) echo " starting scrub of pool '${pool}':" zpool scrub ${pool} + [ $rc -eq 0 ] && rc=1 ;; esac |