[plug] Crontab??

Bernd Felsche bernie at innovative.iinet.net.au
Wed Jul 28 10:18:29 WST 2004


On Wednesday 28 July 2004 06:59, Denis Brown wrote:
> On Wed, 28 Jul 2004, Jay Warwick wrote:
> > On Tue, 2004-07-27 at 20:38, James Devenish wrote:
> > > Also, note that it might not be a good idea to attempt a
> > > "long-running" cron job. If you test the above and it works, you
> > > might then choose to change it to this in future:
> > >
> > > 00  21  * *   fri  env DISPLAY=:0 firefox &

> <snip>

> > be run instead. This brings me to my question - on the last line above,
> > what is the meaning of the '&', does it allow the job to stay open for
> > a longer period?

Not at all. Cron jobs run as long as they have to; unless there's an
external signal/reset/power-off.

Cron only _starts_ jobs at the designated times, watches for their
termination and sends an email of stdout/stderr from the job to the
invoking user.  It doesn't manage jobs... 

> The & at the end of a command line causes the command, once initiated, to
> be sent "to the background" for continued execution.   The means, for
> example, that you can start a long job, then log off without the job
> stopping (because you logged off.)

As cron tasks already run detached from any terminal, the ampersand
is worse than superfluous. Cron will think that the command has
terminated and log the event as being completed before it's actually
done. You'll also miss out on error messages from the job so won't be
able to figure out why they terminate without doing what you want.

-- 
/"\ Bernd Felsche - Innovative Reckoning, Perth, Western Australia
\ /  ASCII ribbon campaign | I'm a .signature virus!
 X   against HTML mail     | Copy me into your ~/.signature
/ \  and postings          | to help me spread!





More information about the plug mailing list