This script parses output of userland tools. In the case of a faulted

zpool the output causes the script to bail out with syntax errors.
Since a scrub of a faulted zpool is pointless, just skip over any pools
marked as such.

PR:	conf/150228
Submitted by:	jpaetzel
Approved by:	kib (mentor)
MFC after:	3 days
MFC note:	only for RELENG_8
This commit is contained in:
Josh Paetzel 2011-01-23 17:13:29 +00:00
parent 1ffa3abd45
commit 16c4413fa6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=217755

View File

@ -24,13 +24,17 @@ case "$daily_scrub_zfs_enable" in
for pool in ${daily_scrub_zfs_pools}; do
# sanity check
zpool list ${pool} >/dev/null 2>&1
_status=$(zpool list ${pool} | sed -n -e '$p')
if [ $? -ne 0 ]; then
echo " WARNING: pool '${pool}' specified in"
echo " '/etc/periodic.conf:daily_scrub_zfs_pools'"
echo " does not exist"
continue
fi
if echo ${_status} | grep -q FAULTED; then
echo "Skipping faulted pool: ${pool}"
continue
fi
# successful only if there is at least one pool to scrub
rc=0