Author: jpaetzel
Date: Sun Jan 23 17:13:29 2011
New Revision: 217755
URL: http://svn.freebsd.org/changeset/base/217755

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

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

Modified: head/etc/periodic/daily/800.scrub-zfs
==============================================================================
--- head/etc/periodic/daily/800.scrub-zfs       Sun Jan 23 16:28:44 2011        
(r217754)
+++ head/etc/periodic/daily/800.scrub-zfs       Sun Jan 23 17:13:29 2011        
(r217755)
@@ -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
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to