2 # /usr/local/sbin/backup-script-wrapper
4 # {{ ansible_managed }}
9 pools=$(zpool list -H | cut -f1)
11 echo "$NAME: Failed to list ZFS pools, aborting!"
14 if [ -z "$pools" ]; then
15 # No pools found, nothing to do, ok.
19 wait_for_scrub_done() {
21 zpool status "$1" 2>/dev/null | fgrep 'scrub in progress' >/dev/null
22 [ $? -eq 0 ] || return 0
27 echo "Scrubbing ZFS storage pools on $(hostname -f):"
33 for pool in $pools; do
34 echo "Scrubbing ZFS storage pool \"$pool\" ..."
35 echo -n "Started: "; date
38 wait_for_scrub_done "$pool"
39 echo -n "Done: "; date
41 echo "Failed to start scrubbing!?"
42 zpool scrub -s "$pool" >/dev/null 2>&1
48 # Show status of ZFS storage pools