#!/bin/bash
#
# This script reads it's configuration from /etc/sysconfig/zfs-fuse
# Please use that file to enable/disable this script or to set the
# type of check you wish performed.
[ -f /etc/sysconfig/zfs-fuse ] || exit 0
. /etc/sysconfig/zfs-fuse
[ "$ZFS_WEEKLY_SCRUB" != "yes" ] && exit 0
zpool=/usr/bin/zpool
pools=`$zpool list -H | cut -f1`
if [ "$pools" != "" ] ; then
echo Found these pools: $pools
for pool in $pools; do
echo "Starting scrub of pool $pool"
$zpool scrub $pool
done
echo "ZFS Fuse automatic scrub start done. Use '$zpool status' to see progress."
fi