[zfs-discuss] scripting the end of a scrub

Omen Wild omen.wild at gmail.com
Wed May 22 13:29:40 EDT 2013


Quoting LosingMy ZFS <losingmyzfs at gmail.com> on Wed, May 22 04:54:
>
> I need to write a script that initiates a scrub, waits for it to
> finish, then upon completion resumes running the script.  I can't seem
> to find a way to do this easily; zpool status (pool) always returns a
> zero even when a scrub is in progress.

I use zsh code like the following:

----- Begin quote -----
pool="${@:-$(/sbin/zpool list -H -o name | tr '\n' ' ')}"

echo "date: starting scrub of: $pool"
/sbin/zpool scrub ${(z)pool}

while /sbin/zpool status ${(z)pool} | /bin/grep -q 'scanned out of'; do
   sleep 60
done
		
/sbin/zpool status ${(z)pool}
----- End quote -----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4270 bytes
Desc: not available
URL: <http://list.zfsonlinux.org/pipermail/zfs-discuss/attachments/20130522/d88c8df8/attachment.bin>


More information about the zfs-discuss mailing list