server-scripts/zfs_scrub.sh

18 lines
352 B
Bash
Raw Normal View History

2020-02-05 02:46:19 +01:00
#!/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"