From 3e59c57c6213975d7ab6afb74bf02bd62416e1af Mon Sep 17 00:00:00 2001 From: James Bunton Date: Tue, 1 Sep 2020 23:47:30 +1000 Subject: [PATCH] lib-ext-backup: exit with error if scrub failed --- hacks/lib-ext-backup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- 2.39.2