From 0b78d365ca5474dacd34a567deecefaa29892ee5 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Wed, 5 Feb 2020 02:46:19 +0100 Subject: [PATCH] Add zfs_scrub.sh --- zfs_scrub.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 zfs_scrub.sh diff --git a/zfs_scrub.sh b/zfs_scrub.sh new file mode 100755 index 0000000..480d436 --- /dev/null +++ b/zfs_scrub.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# ZFS Scrub script + +POOLS=($(cat ~/.zfs_scrub_pools)) +POOLS_STR="" + +for pool in "${POOLS[@]}"; do + echo "Scrub $pool" + zpool scrub $pool + POOLS_STR="$POOLS_STR$pool " +done + +OUTPUT=$(zpool status) + +echo "Sending mail..." +echo -e "Started scrub procedure for $POOLS_STR\n\n$OUTPUT" | $(dirname $0)/mail.sh "ZFS Scrub - $(hostname)" +echo "Done"