From b0fcd5fba2da7b6b37f338f59b97547dd9c97580 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Fri, 5 Feb 2016 17:28:11 +0000 Subject: [PATCH] Add error check to not leak logs with syntax errors in case of failed `zpool history`. MFC after: 1 month --- etc/periodic/daily/800.scrub-zfs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/etc/periodic/daily/800.scrub-zfs b/etc/periodic/daily/800.scrub-zfs index 359be13b227a..b7a009d2c1e9 100755 --- a/etc/periodic/daily/800.scrub-zfs +++ b/etc/periodic/daily/800.scrub-zfs @@ -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) - \