Add error check to not leak logs with syntax errors in case of failed

`zpool history`.

MFC after:	1 month
This commit is contained in:
mav 2016-02-05 17:28:11 +00:00
parent 9accef3f0f
commit c212e48d5b

View File

@ -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) - \