This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: getting cron to work -> status too large for sendmail?

I'll have to try the script -- since my first attempt really is a simple script.

I wrote a simple 17 line script that take a filename argument, opens it, reads 
1 line that it expects to be a number, increments the number and rewrites it to
the file, and closes it.

So my crontab looks like:
# Format of lines:
#min    hour    daymo   month   daywk   cmd
*       *       *       *       *       /home/law/bin/inc_count /etc/count

The first column, I just changed to a '0' so it will only run once an hour as it
was beginning to form a gigantic log file in /tmp (I'll explain).  But I created
the file /etc/count with a value of '0'.  It currently has a value of 678 in it.

If I run the command line manually, it increments the number in the file by a value
of '1' as expected.  Consequently, I believe cron to be correctly running my
script every minute as it is told to.  However -- since I was getting the error --
SENDMAIL message, I put a small shell script in "/usr/sbin/sendmail"s place:

law/bin> ll /usr/sbin/sendmail*
-rwxr-xr-x    1 law      Domain A       26 May 27 04:19 /usr/sbin/sendmail*
lrwxrwxrwx    1 law      Domain A      117 Apr 19 22:55 /usr/sbin/sendmail- -> /
---'re right, it's not really a sendmail, it's a link to ssmtp...well then 
just do a "s/sendmail/ssmtp/" on my previous email...same problem...:-)

anyway my new and improved "sendmail" script says:
law/bin> cat /usr/sbin/sendmail
cat >>/tmp/log
	In /tmp/log, I would see:
From: root (Cron Daemon)
To: law
Subject: Cron <law@Shiva> /home/law/bin/inc_count /etc/count
X-Cron-Env: <!::=::\>
X-Cron-Env: <ALLUSERSPROFILE=C:\Documents and Settings\All Users>
.....a bunch of X-Cron-Env lines corresponding to all of my ENV variables....
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/law>
X-Cron-Env: <LOGNAME=law>

line= 678

Then would repeat another "From ... message" from the next cron invocation.

The tmp file was...well ~4K/run * 678 ~-> 2.6Mb

Perhaps one problem might be that in addition to the normal WinXP env vars that would
be defined for a user, I started cron from one of my cygwin shell windows, so it would
have inherited all of the env vars from personal login as well.  But 
conceivably, one could have more than 4K of env vars declared at the system level
as well  -- Either way, it's would be generating a 4K log file -- most of which I
 wouldn't see (since headers are hidden if I'm reading from, many Win-GUI 
(specifically Outlook in my case) email readers).

Perhaps cron should be purging it's environment or something before starting user
jobs?  Seems a bit unclean to pass my environment to cron but then cron just blindly
pass it's environment to a child.  

I'm guessing there's probably a better way to start cron so it comes up at system
start, but how does it switch user ID's?  It's not like the GUID's are recorded
in /etc/passwd...??  Or does it switch UID's?


> -----Original Message-----
> From: Harig, Mark [] 
> Sent: Tue, May 27, 2003 3:03p
> To: linda w (cyg);
> Subject: RE: getting cron to work -> status too large for sendmail?
> cron does not use sendmail for mail delivery.
> It uses a small program call ssmtp.  Before
> trying to get cron to send email, be sure that
> it is working properly without it.  Try a
> simple cron job such as:
> * * * * * pwd >> /tmp/pwd.txt
> or 
> * * * * * /usr/bin/date >> /tmp/date.txt
> or 
> * * * * * /usr/bin/env > /tmp/env.txt
> If these do not produce what you expect,
> then please run the attached script.  It
> will attempt to diagnose problems with your
> cron setup.  You may need to run it several
> times because it stops each time it finds
> a problem.
> > -----Original Message-----
> > From: linda w (cyg) []
> > Sent: Tuesday, May 27, 2003 2:55 PM
> > To:
> > Subject: getting cron to work -> status too large for sendmail?
> > 
> > 
> > 
> > I was trying to get cron to work -- it looks like it is
> > invoking something on a regular basis, however, it is also
> > trying to send the 1 line of output of cron job to the owner.
> > 
> > In the process it includes the entire environment (in this case
> > of the user who started cron, me). It includes the environment
> > as Header lines:
> > X-Cron-Env: <SESSIONNAME=Console>
> > X-Cron-Env: <SHLVL=1>
> > ...[78 more lines of Environment Variable listing]
> > 
> > This causes sendmail to fail since apparently sendmail has a 4000
> > character limit in the header.
> > 
> > I don't know that I've seen cron include the entire environment
> > as header lines before.  Is that normal behavior?
> > 
> > Am I just exceptionally 'lucky' in that I've hit an obscure limit
> > in sendmail or is this a limitation of sendmail on cygwin?
> > 
> > Any ideas where I should start to address this would be appreciated.
> > It seems slightly kludgey to, say write a manual script to clear 
> > out the environment, but I dunno -- no more kludgy than hard 
> > coding a 4000 character header limit...
> > 
> > -linda
> > 
> > 
> > --
> > Unsubscribe info:
> > Problem reports:
> > Documentation:
> > FAQ:         
> > 
> > 

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]