From owner-svn-src-head@FreeBSD.ORG Wed May 4 12:37:10 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1948106564A; Wed, 4 May 2011 12:37:10 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E055B8FC18; Wed, 4 May 2011 12:37:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p44CbAIq049627; Wed, 4 May 2011 12:37:10 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p44CbAcW049625; Wed, 4 May 2011 12:37:10 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <201105041237.p44CbAcW049625@svn.freebsd.org> From: Alexander Leidinger Date: Wed, 4 May 2011 12:37:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221430 - head/etc/periodic/daily X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 May 2011 12:37:11 -0000 Author: netchild Date: Wed May 4 12:37:10 2011 New Revision: 221430 URL: http://svn.freebsd.org/changeset/base/221430 Log: Use proper return codes (valuable output, invalid config, problems). MFC after: 1 week Modified: head/etc/periodic/daily/800.scrub-zfs Modified: head/etc/periodic/daily/800.scrub-zfs ============================================================================== --- head/etc/periodic/daily/800.scrub-zfs Wed May 4 11:22:52 2011 (r221429) +++ head/etc/periodic/daily/800.scrub-zfs Wed May 4 12:37:10 2011 (r221430) @@ -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