From: James Bunton Date: Tue, 1 Sep 2020 13:47:30 +0000 (+1000) Subject: lib-ext-backup: exit with error if scrub failed X-Git-Url: https://code.delx.au/monosys/commitdiff_plain/3e59c57c6213975d7ab6afb74bf02bd62416e1af lib-ext-backup: exit with error if scrub failed --- diff --git a/hacks/lib-ext-backup b/hacks/lib-ext-backup index 4e72792..bca5e44 100644 --- a/hacks/lib-ext-backup +++ b/hacks/lib-ext-backup @@ -48,7 +48,7 @@ function pool_export { } function pool_setup { - zpool set failmode=continue "$ZPOOLNAME" + zpool set failmode=wait "$ZPOOLNAME" zfs set mountpoint="/mnt/$ZPOOLNAME" "$ZPOOLNAME" chmod 0700 "/mnt/$ZPOOLNAME" zfs set compression=lz4 "$ZPOOLNAME" @@ -74,7 +74,7 @@ function pool_maybe_scrub { echo "> zpool scrub $ZPOOLNAME" zpool scrub "$ZPOOLNAME" - while zpool status "$ZPOOLNAME" | grep -q "scrub in progress"; do + while zpool status "$ZPOOLNAME" | awk '/state: ONLINE|scan: scrub in progress/ {x++} END {exit x-2}'; do echo -n . sleep 60 done