setlock-ing serialmail?

2000-05-18 Thread Paulo Jan

Hi all:

Leaving aside Taylor UUCP and aliases for the moment...
I have a customer with a dialup connection that has a Linux server with
qmail/serialmail, and sends us their outgoing mail following the recipe
in the TOISP file of the serialmail distribution. They have a cron job
that executes maildirsmtp every 30 minutes to send the mail queue, etc.,
etc. The problem is that they often send very big files through mail (I
know, I know...),  so the queue gets very big and the following
situation often arises:

1) maildirsmtp gets executed. The server starts sending out the 30 Mb.
or so of messages.
2) After 30 minutes, the queue hasn't been sent completely yet, but
another instance of maildirsmtp is started, and begins sending messages
from the queue again.
3) After a few hours, one can find 10 or 11 instances of maildirsmtp
running at the same time on the dialup line.

My questions are:

1) Could I run setlock with maildirsmtp to prevent this situation? Say:

/usr/local/bin/setlock -nx ~alias/pppdir/seriallock
/usr/local/bin/maildirsmtp ~alias/outmail alias-outmail-
(MY_MAIL_SERVER_IP) `hostname`

I think there's nothing wrong with the above line, but I'd like to
check with somebody else.
2) How does maildirsmtp "decide" which messages of the queue to send?
If I understand serialmail's mechanism correctly, in the situation above
described the second instance of maildirsmtp should start sending again
the same messages than the first one, but from what I've seen it doesn't
do so. Can maildirsmtp "know" which messages of the queue are "locked"
by another instance of the program? The man pages don't say anything
about this.
3) If there are new messages arriving to the queue while maildirsmtp is
working, does it send them in the current batch, or they have to wait
for the next time maildirsmtp is executed?



Paulo Jan.
DDnet.



Re: setlock-ing serialmail?

2000-05-18 Thread Mikko Hänninen

Paulo Jan [EMAIL PROTECTED] wrote on Thu, 18 May 2000:
   1) maildirsmtp gets executed. The server starts sending out the 30 Mb.
 or so of messages.
   2) After 30 minutes, the queue hasn't been sent completely yet, but
 another instance of maildirsmtp is started, and begins sending messages
 from the queue again.

When I was using a similar setup, I had this code snippet as part of my
"pppdeliver" script that invoked maildirsmtp:

# Sanity check to avoid two copies running simultaneously
if [ -e $PIDFILE ]; then
  # pppdeliver is already running
  OTHERPID=`cat $PIDFILE`
  logger -t pppdeliver -p mail.notice [$$] Already running at PID $OTHERPID
  exit 1
else
  echo $$  $PIDFILE
fi

It's not secure etc. etc. but it worked. :-)
Also the script would of course rm $PIDFILE before exiting.

Anyway, any other sort of locking mechanism should work just as well I
imagine.  Sorry, I don't know enough about maildirsmtp to answer your
other questions.


Regards,
Mikko
-- 
// Mikko Hänninen, aka. Wizzu  //  [EMAIL PROTECTED]  //  http://www.iki.fi/wiz/
// The Corrs list maintainer  //   net.freak  //   DALnet IRC operator /
// Interests: roleplaying, Linux, the Net, fantasy  scifi, the Corrs /
Change is inevitable, except from a vending machine.