[OpenIndiana-discuss] auto-scrub and its result

Jim Klimov jimklimov at cos.ru
Sat Dec 29 19:51:03 UTC 2012


On 2012-12-29 14:42, Edward Ned Harvey (openindiana) wrote:
>> From: Bob Friesenhahn [mailto:bfriesen at simple.dallas.tx.us]
>>
>> 20 3 * * 1 /usr/sbin/zpool scrub rpool
>
> I'm not 100% sure if this will work directly inside a cron job; you might have to stick it inside of a bash shell script, and then have cron call the shell script.  (This is what I do).
>
> for pool in `/usr/sbin/zpool list -H -o name` ; do /usr/sbin/zpool scrub $pool ; done

Well, apparently Bob does use the copypasted line and it works for him ;)

Cron entries can be long single-line shell (/sbin/sh or user's shell?)
scripts, but anything over a line or two is impractical to maintain in
the crontab. The construct I do often use for optional programs is

* * * * *  [ -x /path/prog ] && /path/prog params

This does not generate tons of email complaints if the prog is not
installed in a particular zone, and allows to copypaste typical setup
files :)

//Jim




More information about the OpenIndiana-discuss mailing list