2019-01-30 17:26:24 +03:00
|
|
|
#!/bin/sh -eu
|
|
|
|
|
2020-03-20 19:28:41 +03:00
|
|
|
# Scrub all healthy pools that are not already scrubbing.
|
2019-01-30 17:26:24 +03:00
|
|
|
zpool list -H -o health,name 2>&1 | \
|
|
|
|
awk 'BEGIN {FS="\t"} {if ($1 ~ /^ONLINE/) print $2}' | \
|
|
|
|
while read pool
|
|
|
|
do
|
2020-03-20 19:28:41 +03:00
|
|
|
if ! zpool status "$pool" | grep -q "scrub in progress"
|
|
|
|
then
|
|
|
|
zpool scrub "$pool"
|
|
|
|
fi
|
2019-01-30 17:26:24 +03:00
|
|
|
done
|