# This serializes the zfs scrub process for each pool.
maxsleeptime=360
+logfile=/var/log/zfs-scrub.log
for i in tank storage
do
fi
done
- echo "Scrubing zfs pool $i"
+ date=`date`
+ echo "$date: Scrub started for zfs pool $i" >> $logfile
/sbin/zpool scrub $i
+ sleep 60
done
maxsleeptime=360
mailto=root
+logfile=/var/log/zfs-scrub.log
for i in backups
do
fi
done
- echo "Scrubing zfs pool $i"
- /usr/local/etc/bin/usb-drive-power on
+ date=`date`
+ echo "$date: Scrub started for zfs pool $i" >> $logfile
+ /usr/local/etc/bin/usb-drive-power on >> /dev/null
/sbin/zpool import $i
/sbin/zpool scrub $i
fi
done
+ date=`date`
+ echo "$date: Scrub completed for zfs pool $i" >> $logfile
+
# Check for any scrub errors
/sbin/zpool status $i | grep scrub: | grep "with 0 errors" > /dev/null 2>&1
if [ $? != 0 ]; then
# Power off the USB drive
/sbin/zpool export $i
- /usr/local/etc/bin/usb-drive-power off
+ /usr/local/etc/bin/usb-drive-power off >> /dev/null
done