Author: mav
Date: Fri Feb  5 17:28:11 2016
New Revision: 295324
URL: https://svnweb.freebsd.org/changeset/base/295324

Log:
  Add error check to not leak logs with syntax errors in case of failed
  `zpool history`.
  
  MFC after:    1 month

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

Modified: head/etc/periodic/daily/800.scrub-zfs
==============================================================================
--- head/etc/periodic/daily/800.scrub-zfs       Fri Feb  5 17:14:37 2016        
(r295323)
+++ head/etc/periodic/daily/800.scrub-zfs       Fri Feb  5 17:28:11 2016        
(r295324)
@@ -63,6 +63,11 @@ case "$daily_scrub_zfs_enable" in
                        _last_scrub=$(zpool history ${pool} | \
                            sed -ne '2s/ .*$//p')
                fi
+               if [ -z "${_last_scrub}" ]; then
+                       echo "   skipping scrubbing of pool '${pool}':"
+                       echo "      can't get last scrubbing date"
+                       continue
+               fi
 
                # Now minus last scrub (both in seconds) converted to days.
                _scrub_diff=$(expr -e \( $(date +%s) - \
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to