Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jan 2011 18:25:51 +0000 (UTC)
From:      Josh Paetzel <jpaetzel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r218027 - stable/8/etc/periodic/daily
Message-ID:  <201101281825.p0SIPpaQ093834@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jpaetzel
Date: Fri Jan 28 18:25:51 2011
New Revision: 218027
URL: http://svn.freebsd.org/changeset/base/218027

Log:
  MFC: r217755 r217822
  
  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
  Approved by:	kib (mentor)

Modified:
  stable/8/etc/periodic/daily/800.scrub-zfs
Directory Properties:
  stable/8/etc/   (props changed)

Modified: stable/8/etc/periodic/daily/800.scrub-zfs
==============================================================================
--- stable/8/etc/periodic/daily/800.scrub-zfs	Fri Jan 28 17:37:09 2011	(r218026)
+++ stable/8/etc/periodic/daily/800.scrub-zfs	Fri Jan 28 18:25:51 2011	(r218027)
@@ -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,13 +28,19 @@ 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}" 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
+		_status=${_status##*$newline}
+		case ${_status} in
+		*FAULTED*)
+			echo "Skipping faulted pool: ${pool}"
+			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?201101281825.p0SIPpaQ093834>