ZFS scrub is finished?

Steve Bertrand steve at ibctech.ca
Sat Jul 11 19:08:06 UTC 2009

xorquewasp at googlemail.com wrote:
> Hello.
> I'd like to write a little shell script to run 'zpool scrub' on
> my disks weekly. I have two zpools. The manual page says that only
> one 'scrub' can be active at a time.
> Is there any reliable way to run 'zpool scrub X' and then run
> 'zpool scrub Y' when the first has finished?

Perhaps it is as simple as cron-ing something like the following (of
course, replace "zpool scrub" with my cat commands.

I have three commands below, the second one in place only to verify that
the commands 'did the right thing' by waiting for the first to finish.

Note that if your second scrub command requires the first to exit
without any errors, this will not be an appropriate solution, as you'll
obviously want to catch the error and cancel the second scrub:

% cat a.fil && sleep 3 && cat b.fil

[1] 29821
this is a
% this is b

[1]    Done     ( cat a.fil && sleep 3 && cat b.fil )

If you want to run it at the command line, simply throw another '&' at
the end of the entire command string to ensure that if your terminal
terminates, the process(es) will continue thereafter.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3233 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20090711/9226113a/smime.bin

More information about the freebsd-questions mailing list