Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Jan 2011 13:41:48 +0000 (UTC)
From:      Josh Paetzel <jpaetzel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r217822 - head/etc/periodic/daily
Message-ID:  <201101251341.p0PDfmP8034060@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jpaetzel
Date: Tue Jan 25 13:41:48 2011
New Revision: 217822
URL: http://svn.freebsd.org/changeset/base/217822

Log:
  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

Modified:
  head/etc/periodic/daily/800.scrub-zfs

Modified: head/etc/periodic/daily/800.scrub-zfs
==============================================================================
--- head/etc/periodic/daily/800.scrub-zfs	Tue Jan 25 11:04:16 2011	(r217821)
+++ head/etc/periodic/daily/800.scrub-zfs	Tue Jan 25 13:41:48 2011	(r217822)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101251341.p0PDfmP8034060>