delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/05/27/19:08:47

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "linda w \(cyg\)" <cygwin AT tlinx DOT org>
To: "'Harig, Mark'" <maharig AT idirect DOT net>
Cc: <cygwin AT cygwin DOT com>
Subject: RE: getting cron to work -> status too large for sendmail?
Date: Tue, 27 May 2003 16:08:34 -0700
Message-ID: <001c01c324a4$e5b8dd00$1403a8c0@sc.tlinx.org>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Importance: Normal
In-Reply-To: <BADF3C947A1BD54FBA75C70C241B0B9E7633F2@ex02.idirect.net>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id h4RN8kH23142

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- -> /
usr/sbin/ssmtp*
---
	Yeah...you'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
#!/bin/sh
cat >>/tmp/log
----
	In /tmp/log, I would see:
From: root (Cron Daemon)
To: law
Subject: Cron <law AT 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?

thanks,
linda






> -----Original Message-----
> From: Harig, Mark [mailto:maharig AT idirect DOT net] 
> Sent: Tue, May 27, 2003 3:03p
> To: linda w (cyg); cygwin AT cygwin DOT com
> 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) [mailto:cygwin AT tlinx DOT org]
> > Sent: Tuesday, May 27, 2003 2:55 PM
> > To: cygwin AT cygwin DOT com
> > 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:      http://cygwin.com/ml/#unsubscribe-simple
> > Problem reports:       http://cygwin.com/problems.html
> > Documentation:         http://cygwin.com/docs.html
> > FAQ:                   http://cygwin.com/faq/
> > 
> > 
> 


--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019