--- 800.scrub-zfs.orig 2011-06-30 22:52:01.291279403 -0700 +++ 800.scrub-zfs 2011-06-30 22:52:08.707039940 -0700 @@ -51,10 +51,11 @@ _pool_threshold=${daily_scrub_zfs_default_threshold} fi - _last_scrub=$(zpool history ${pool} | \ - egrep "^[0-9\.\:\-]{19} zpool scrub ${pool}\$" | tail -1 |\ - cut -d ' ' -f 1) - if [ -z "${_last_scrub}" ]; then + _last_successful_scrub=$(zpool history ${pool} | \ + egrep "^[0-9\.\:\-]{19} zpool scrub( -s | )${pool}\$" | \ + awk 'BEGIN { scrub1="" }; /zpool scrub -s/{ scrub1=scrub2 }; \ + /zpool scrub/ && ! / -s /{ scrub2=scrub1; scrub1=$1 }; END { print scrub1 }') + if [ -z "${_last_successful_scrub}" ]; then # creation time of the pool if no scrub was done _last_scrub=$(zpool history ${pool} | \ sed -ne '2s/ .*$//p')