[OpenIndiana-discuss] Cron best practice

Robbie Crash sardonic.smiles at gmail.com
Tue May 15 22:50:18 UTC 2012


That's pretty much exactly what I mean. Telling cron to tar dirA then turns
into tar then copy tar.gz to serverB turns into  tar, copy, rename old
copy, turns into tar, copy, rename, rename old version, delete any older
than 5 then email Bill to let him know it's complete and when Bill replies
then do task B.

I find myself generally calling each thing by cron due to issues that I
never quite understood with random portions of scripts failing due to cron
calling things slightly differently and being weird about some PATH
variables as opposed to just executing the script normally. But this makes
for extremely ugly crontabs.

On Linux there's a way to call things as cron does, it escapes me now but I
know it's there, can someone enlighten me as to how I approximate it on OI?

On Tue, May 15, 2012 at 6:37 PM, Jim Klimov <jimklimov at cos.ru> wrote:

> 2012-05-15 0:26, Robbie Crash wrote:
>
>> The thing I'm unsure of is if it's best practice to get cron to perform
>> the
>> task, or if it's better to get cron to call a script.
>>
>
> If you mean cron one-liners growing into three-line scripts,
> that's about as far as I allow them to grow - and that if most
> of the line is parameters to some command(s) it ultimately calls.
>
> It is indeed somewhat harder to track down from cron into scripts,
> but much easier to maintain/develop/debug/enhance the scripts and
> keep them in some CVS/SVN/... service to reuse between servers.
>
> There is also a matter of large jobs taking a random amount of
> time (i.e. due to some intermittent network hickups, or hight CPU
> usage from other tasks), and cron'ed jobs begin to overlay one
> another contributing to the system lags. It is easier to implement
> anti-overlay locking in a script (so that it exits quickly if an
> instance is already running).
>
> HTH,
> //Jim
>
>
> ______________________________**_________________
> OpenIndiana-discuss mailing list
> OpenIndiana-discuss@**openindiana.org<OpenIndiana-discuss at openindiana.org>
> http://openindiana.org/**mailman/listinfo/openindiana-**discuss<http://openindiana.org/mailman/listinfo/openindiana-discuss>
>



-- 
Seconds to the drop, but it seems like hours.

http://www.eff.org/
<http://www.eff.org/>http://creativecommons.org/


More information about the OpenIndiana-discuss mailing list