18 lines
573 B
Bash
Executable file
18 lines
573 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
|
# license: MIT
|
|
|
|
[[ "$EUID" != 0 ]] && printf "error: permission denied!\n" && exit 1
|
|
|
|
printf "scrubbing all available zfs pools...\n"
|
|
|
|
mapfile -t pools < <(zpool list | tail -n +2 | awk '{print $1}')
|
|
for pool in "${pools[@]}"; do
|
|
timestamp="$SECONDS"
|
|
printf "scrubbing zfs pool '"$pool"'...\n"
|
|
zpool scrub -w "$pool"
|
|
printf "scrubbing zfs pool '"$pool"' finished after $(( $SECONDS - $timestamp )) seconds!\n"
|
|
done
|
|
|
|
printf "scrubbing all available zfs pools finished after $SECONDS seconds!\n"
|