Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Jun 2011 11:36:06 +0000 (UTC)
From:      Alexander Leidinger <netchild@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: r222857 - stable/8/etc/periodic/daily
Message-ID:  <201106081136.p58Ba68D029193@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: netchild
Date: Wed Jun  8 11:36:06 2011
New Revision: 222857
URL: http://svn.freebsd.org/changeset/base/222857

Log:
  MFC r221430:
    Use proper return codes (valuable output, invalid config, problems).

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

Modified: stable/8/etc/periodic/daily/800.scrub-zfs
==============================================================================
--- stable/8/etc/periodic/daily/800.scrub-zfs	Wed Jun  8 10:59:36 2011	(r222856)
+++ stable/8/etc/periodic/daily/800.scrub-zfs	Wed Jun  8 11:36:06 2011	(r222857)
@@ -26,10 +26,12 @@ case "$daily_scrub_zfs_enable" in
 		daily_scrub_zfs_pools="$(zpool list -H -o name)"
 	fi
 
+	rc=0
 	for pool in ${daily_scrub_zfs_pools}; do
 		# sanity check
 		_status=$(zpool list "${pool}" 2> /dev/null)
 		if [ $? -ne 0 ]; then
+			rc=2
 			echo "   WARNING: pool '${pool}' specified in"
 			echo "            '/etc/periodic.conf:daily_scrub_zfs_pools'"
 			echo "            does not exist"
@@ -38,13 +40,11 @@ case "$daily_scrub_zfs_enable" in
 		_status=${_status##*$newline}
 		case ${_status} in
 		*FAULTED*)
+			rc=3
 			echo "Skipping faulted pool: ${pool}"
 			continue ;;
 		esac
 
-		# successful only if there is at least one pool to scrub
-		rc=0
-
 		# determine how many days shall be between scrubs
 		eval _pool_threshold=\${daily_scrub_zfs_${pool}_threshold}
 		if [ -z "${_pool_threshold}" ];then
@@ -77,10 +77,12 @@ case "$daily_scrub_zfs_enable" in
 			*"none requested"*)
 				echo "   starting first scrub (since reboot) of pool '${pool}':"
 				zpool scrub ${pool}
+				[ $rc -eq 0 ] && rc=1
 				;;
 			*)
 				echo "   starting scrub of pool '${pool}':"
 				zpool scrub ${pool}
+				[ $rc -eq 0 ] && rc=1
 				;;
 		esac
 



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