#!/bin/sh -eu which zpool >/dev/null || exit 0 zpool list -H -o health,name 2>&1 | \ awk 'BEGIN {FS="\t"} {if ($1 ~ /^ONLINE/) print $2}' | \ while read pool ; do zpool scrub "$pool" done