# That only 1 scrub operation is running at any given time.
# This serializes the zfs scrub process for each pool.
+PATH=/usr/sbin:/sbin:$PATH
+
maxsleeptime=360
+logfile=/var/log/zfs/zfs-scrub.log
for i in tank storage
do
# Check to see if this zfs filesystem has a scrub being performed on it now.
# If it does, we cannot perform more than one scrub operation at a time.
while true; do
- /sbin/zpool status | grep scrub: | grep "in progress" > /dev/null 2>&1
+ zpool status | grep scrub: | grep "in progress" > /dev/null 2>&1
if [ $? == 0 ]; then
# Another zpool scrub operation is already running
# Wait until it is done before continuing
fi
done
- echo "Scrubing zfs pool $i"
- /sbin/zpool scrub $i
+ date=`date`
+ echo "$date: Scrub started for zfs pool $i" >> $logfile
+ zpool scrub $i
+ sleep 60
done