[plug] Crontab??

James Devenish devenish at guild.uwa.edu.au
Wed Jul 28 08:54:12 WST 2004


In message <1090969994.6792.16.camel at hosrv01.jtajt.local>
on Wed, Jul 28, 2004 at 07:13:14AM +0800, Jay Warwick wrote:
> Not sure if this means I need to be logged on to be able to start the
> job - root job scheduled to start at 4am

It should run fine even if you are not logged in at all, unless it is a
GUI programme. But your comment (and Marcus') to the effect that "the
job would not work" confuses me. It almost sounds like you're saying
that you get "no feedback" about your jobs, and that surprises me.
Normally, if a cron job fails (or even if it just prints a message),
cron will e-mail you with the details. I wonder if this is related to
Bernd's comment about an "unfixed" security problem in cron -- is this
really true? If such a fundamental and widespread problem exists, I am
somewhat surprised that it slipped right past me (it does not seem to
have made it into any AUSCERT advisories or development lists or package
distributions that I monitor -- how could it be so widely overlooked?).

In message <1090969349.10356.5.camel at rattus.Localdomain>
on Wed, Jul 28, 2004 at 07:02:29AM +0800, William Kenworthy wrote:
> The "&" tells the command to execute and return control back to the
> terminal straight away.  Normally not used in a crontab, and might cause
> problems.

& should not cause problems, except that 'error messages' won't be
captured directly by cron. Although I'm a zsh user and could be mistaken
about POSIX shell behaviour, I was under the impression that cron jobs
would run without "job control". Thus, you do not have to worry about
SIGHUP or anything like that -- jobs will go into the background in
"disowned" state (which is a good thing). Marcus' idea of using nohup,
though, is useful for capturing a backgrounded process's output. But
generally I prefer

( date; env BLAH=blah programme ) >> $HOME/programme.log 2>&1 &

so that I can both keep a history of events without worrying about the
job "timing out" or anything like that. I don't always put long jobs in
the background, though. And, sometimes, I use `tee` to both keep a log
file on the local host *and* let cron send me e-mail. I just depends on
the circumstances and the host on which the jobs run. Options, options.





More information about the plug mailing list