<<< Date Index >>>     <<< Thread Index >>>

Re: Lost connection when scripted



> On Tuesday, July 29 at 05:10 PM, quoth Chris Green:
>>When running this script at the command line everything works as 
>>expected - I get the mail in my inbox with the report as the body of 
>>the mail, about 8KB in size. However, when I execute the same script 
>>via cron I experience a "lost connection after DATA" error on the 
>>mail server.
> 
> So the question to ask is: what's different? The usual differences 
> between cron and the commandline are the user and the environment. For 
> example, does cron have the same PATH (so is it using the same mutt 
> binary?)? Is it running as a different user (so does it have 
> permissions to read your muttrc?)? Does it have the same $HOME 
> directory (so is it looking for a muttrc in the wrong place?)? Does 
> cron place some restrictions (e.g. length of time or amount of memory 
> consumed) on tasks?
> 
> ~Kyle

The environment is waaayyy different in cron than at the command line - 
different shell, different PATH, different just about everything. But this 
turned out to be a bit of a red herring in the end.

The problem I was experiencing is due to cron not dealing with stdout very 
well, so I needed to add a>/dev/null 2>&1 at the end of the mutt command line 
in my shell script and then everything worked like a charm :-)

Thanks Kyle for your comments, much appreciated.


_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx