X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=AnsibleRoles.git;a=blobdiff_plain;f=roles%2Flinux-zfs%2Ftemplates%2Fzpool-scrub.sh.j2;fp=roles%2Flinux-zfs%2Ftemplates%2Fzpool-scrub.sh.j2;h=0000000000000000000000000000000000000000;hp=9ee29d1b387fa9bee5c24d5cd51277d0de0dd221;hb=9e448cbdcdd811d7ae0fb6c3564419e6f8144461;hpb=311948867ac0b4bf3703d27e558cc11315643247 diff --git a/roles/linux-zfs/templates/zpool-scrub.sh.j2 b/roles/linux-zfs/templates/zpool-scrub.sh.j2 deleted file mode 100644 index 9ee29d1..0000000 --- a/roles/linux-zfs/templates/zpool-scrub.sh.j2 +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -# /usr/local/sbin/backup-script-wrapper -# --- -# {{ ansible_managed }} -# --- - -NAME=$(basename "$0") - -pools=$(zpool list -H | cut -f1) -if [ $? -ne 0 ]; then - echo "$NAME: Failed to list ZFS pools, aborting!" - exit 1 -fi -if [ -z "$pools" ]; then - # No pools found, nothing to do, ok. - exit 0 -fi - -wait_for_scrub_done() { - while true; do - zpool status "$1" 2>/dev/null | fgrep 'scrub in progress' >/dev/null - [ $? -eq 0 ] || return 0 - sleep 60 - done -} - -echo "Scrubbing ZFS storage pools on $(hostname -f):" -echo - -zpool list -echo - -for pool in $pools; do - echo "Scrubbing ZFS storage pool \"$pool\" ..." - echo -n "Started: "; date - zpool scrub "$pool" - if [ $? -eq 0 ]; then - wait_for_scrub_done "$pool" - echo -n "Done: "; date - else - echo "Failed to start scrubbing!?" - zpool scrub -s "$pool" >/dev/null 2>&1 - sleep 5 - fi - echo -done - -# Show status of ZFS storage pools -zpool status