Sendmail Upgrade, new thread

Scott Silva ssilva at sgvwater.com
Tue Apr 11 17:12:30 IST 2006


Roger Jochem spake the following on 4/11/2006 8:53 AM:
> The command is really flock, in lines 30 and 219 of the script. I
> attached the file to this e-mail. I just need to change these two commands?
> 
> Regards
> 
> Roger Jochem
> 
> ----- Original Message ----- From: "Glenn Steen" <glenn.steen at gmail.com>
> To: "MailScanner discussion" <mailscanner at lists.mailscanner.info>
> Sent: Tuesday, April 11, 2006 12:40 PM
> Subject: Re: Sendmail Upgrade, new thread
> 
> 
>> On 11/04/06, Roger Jochem <roger at rudnick.com.br> wrote:
>>> Hello all!
>>>
>>> I finally found the problem with my mail server with messages sended
>>> with an
>>> empty body (problem related in the e-mail bellow).
>>>
>>> Turn's out that MailScanner is fine, sendmail is fine,  and the
>>> problem was
>>> with Mailwatch.
>>>
>>> There is a php script in /usr/local/bin called "mailq" that reads the
>>> mail
>>> queue to show in Mailwatch frontend. This script runs every minute,
>>> and it
>>> locks the messages (sometimes), and because of that MailScanner sends
>>> the
>>> empty messages (with the locking error) and then after that the normal
>>> (full) message. I turned that script off and now everything is working
>>> fine... What a fight...
>>>
>>> Is there something I have to do with that script to make it run with
>>> sendmail 8.13 ?
>>>
>>> Regards
>>>
>>> Roger Jochem
>>>
>> Seems that script is using flock for locking, not lockf (posix). So
>> Steve (or *someone*) might have something to do there:-). Usual
>> disclaimer applies: I might be reading the code wrong;).
>>
>> -- 
>> -- Glenn
>> email: glenn < dot > steen < at > gmail < dot > com
>> work: glenn < dot > steen < at > ap1 < dot > se
>> -- 
>> MailScanner mailing list
>> mailscanner at lists.mailscanner.info
>> http://lists.mailscanner.info/mailman/listinfo/mailscanner
>>
>> Before posting, read http://wiki.mailscanner.info/posting
>>
>> Support MailScanner development - buy the book off the website! 
That command seems to only lock only itself to keep multiple copies of the
program from running.
QUOTE
	// Prevent multiple copies running
$fl = fopen("/var/run/mailq.lock", "w+");
// Attempt to create an exclusive lock - continue if successful
if(flock($fl, LOCK_EX + LOCK_NB)) {

/QUOTE
It opens a lock file, and if it succeeds, it runs. If it can't open the lock
file for write ("w+"), the program assumes it is already running. That way if
it is fired every minute, but a large queue keeps the previous run open for
more than that minute it won't run again.
BTW, I think it should only run every 5 minutes. I think that is a symptom,
not a cause.
I, and many other people, are running that very script with no problems.
Are you running a distro supplied version of sendmail, or did you get it from
"outside the chain"?



-- 

MailScanner is like deodorant...
You hope everybody uses it, and
you notice quickly if they don't!!!!



More information about the MailScanner mailing list