3 # Author: Alan J. Pippin
4 # Description: This script will attempt to scrub each zfs pool
5 # given to it in the for loop. This script ensures
6 # That only 1 scrub operation is running at any given time.
7 # This serializes the zfs scrub process for each pool.
13 # Check to see if this zfs filesystem has a scrub being performed on it now.
14 # If it does, we cannot perform more than one scrub operation at a time.
16 /sbin/zpool status | grep scrub: | grep "in progress" > /dev/null 2>&1
18 # Another zpool scrub operation is already running
19 # Wait until it is done before continuing
20 ransleep=$(($RANDOM % $maxsleeptime))
23 # Another zpool scrub operation is not running
28 echo "Scrubing zfs pool $i"