summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorjpaetzel <jpaetzel@FreeBSD.org>2011-01-25 13:41:48 +0000
committerjpaetzel <jpaetzel@FreeBSD.org>2011-01-25 13:41:48 +0000
commit72db8e56861a54e3d2ddfca3de0f5a7354e1df2f (patch)
treec84943075a753f0e2d106ce99e49d2b82bec5b7a /etc
parentca24f47263b5d123a95f927daf2114c1e6b39ac5 (diff)
downloadFreeBSD-src-72db8e56861a54e3d2ddfca3de0f5a7354e1df2f.zip
FreeBSD-src-72db8e56861a54e3d2ddfca3de0f5a7354e1df2f.tar.gz
Fix logic error introduced in previous commit.
Along the way make some efficiency improvements. Submitted by: jilles Approved by: kib (mentor) MFC after: 3 days
Diffstat (limited to 'etc')
-rwxr-xr-xetc/periodic/daily/800.scrub-zfs14
1 files changed, 10 insertions, 4 deletions
diff --git a/etc/periodic/daily/800.scrub-zfs b/etc/periodic/daily/800.scrub-zfs
index 01577c1..de139c2 100755
--- a/etc/periodic/daily/800.scrub-zfs
+++ b/etc/periodic/daily/800.scrub-zfs
@@ -5,6 +5,10 @@
# If there is a global system configuration file, suck it in.
#
+
+newline="
+" # A single newline
+
if [ -r /etc/defaults/periodic.conf ]
then
. /etc/defaults/periodic.conf
@@ -24,17 +28,19 @@ case "$daily_scrub_zfs_enable" in
for pool in ${daily_scrub_zfs_pools}; do
# sanity check
- _status=$(zpool list ${pool} | sed -n -e '$p')
+ _status=$(zpool list "${pool}" 2> /dev/null)
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
+ _status=${_status##*$newline}
+ case ${_status} in
+ *FAULTED*)
echo "Skipping faulted pool: ${pool}"
- continue
- fi
+ continue ;;
+ esac
# successful only if there is at least one pool to scrub
rc=0
OpenPOWER on IntegriCloud