1.5.19: tar runs normally from command line but terminates early when run from crontab

Igor Peshansky pechtcha@cs.nyu.edu
Thu Jun 22 15:08:00 GMT 2006


On Thu, 22 Jun 2006, G.W. Haywood wrote:

> Hi Eric, Charles,
>
> Thanks for the help guys, that got me going in the right direction.
>
> On Mon, 19 Jun 2006, Eric Blake <ebb9@XXX.XXX> wrote:

<http://cygwin.com/acronyms/#PCYMTNQREAIYR>.  Thanks.

> > According to G.W. Haywood on 6/19/2006 3:53 AM:
> >
> > > When run from the command line the job works ... and when run from
> > > the crontab it fails...
> >
> > It's probably a bug in your cron setup, rather than a bug in tar.  Have
> > you run cron-diagnose?  Can you get simpler cron tasks to work?  Remember
> > that cron is run as a different user than the normal command line, so
> > permissions do play a role on what the cron script can do.
>
> The cron instance was running as the same user that could successfully
> run the tar job from the command line, so it wasn't permissions, but I
> think you're right, Eric, about it being the cron setup.  I think that
> the problem is there's no MTA running on the box.  Even though there's
> no mail to be sent by cron it seems to be trying to connect to an MTA
> before finding that there's no mail to send.  Unfortunately, when it
> finds there's no MTA it terminates the job.  (If I had syslog running
> it might tell me... :)

Check the Windows event log.  Or install a syslog daemon (Cygwin has 2 --
the original syslog in inetutils, and syslogng in syslog-ng).

> When I redirected tar's stdout (as well as the existing redirection of
> its stderr) to a file, the tar job in the crontab ran to completion.

Yes, cron will try to email you the output of a job if it's not redirected
into a file, even if the output is empty.

> Funny thing is, I'm sure I have several Linux machines kicking around
> which are running jobs from crontabs but not running MTAs.  I'd better
> check that, I suppose...

You don't need to *run* an MTA, only to have an MTA installed (e.g.,
sendmail).  FWIW, Cygwin has a few MTAs that you can use (ssmtp, exim).

> On Wed, 21 Jun 2006, Stepp, Charles wrote:
>
> > running from cron does not set the environment the same as with an
> > interactive session.
>
> Charles, I was pretty sure that it wasn't an environment problem as
> the command shouldn't be relying on anything in the environment for
> its execution (sure, you never know until you try:).

Well, if your cron job says "tar" instead of "/usr/bin/tar", you're
relying on the environment.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list