Add zfs_scrub.sh

This commit is contained in:
Alice Gaudon 2020-02-05 02:46:19 +01:00
parent 15794e13a5
commit 0b78d365ca

17
zfs_scrub.sh Executable file
View File

@ -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"