fetchmail starts too fast for spamd

fetchmail starts too fast for spamd

am 09.03.2006 03:30:20 von Tristan Miller

Greetings.

I use Fetchmail to fetch mail from various POP3 and IMAP accounts and
Procmail to pipe the retrieved mail through SpamAssassin (using spamd).
This works fine, except that the first few messages fetched after booting
don't seem to get processed by SpamAssassin. This means I end up with
about a half-dozen spam mails in my inbox every time I start up my machine
after it's been off for a few hours.

I suspect the problem is that my system loads the Fetchmail daemon first,
and then the SpamAssassin daemon a few seconds later; in the few seconds
that Fetchmail runs, it manages to download a dozen or so messages and
pipes them to spamc, which can't connect to spamd and so passes the
message through unchanged.

I thought the solution would be simply to use the -t argument to spamc to
give it more time to connect to the spamd daemon. However, when I tried
disabling spamd and then running

cat some-email.txt | spamc -t x

from the command line, spamc didn't wait any longer no matter what value of
x I used; it just waited for a second and then spit out some-email.txt
as-is. Ditto when using the -x option.

Am I doing anything wrong? Is there something besides fiddling with spamc
arguments I can use to make sure fetchmail doesn't start running until
spamd has started up? (I am running SuSE 9.3.)

Regards,
Tristan

--
_
_V.-o Tristan Miller [en,(fr,de,ia)] >< Space is limited
/ |`-' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= <> In a haiku, so it's hard
(7_\\ http://www.nothingisreal.com/ >< To finish what you

Re: fetchmail starts too fast for spamd

am 09.03.2006 04:34:01 von Neil Woods

>>>>> Tristan Miller writes:

> Greetings.
>
> I use Fetchmail to fetch mail from various POP3 and IMAP accounts and
> Procmail to pipe the retrieved mail through SpamAssassin (using spamd).
> This works fine, except that the first few messages fetched after booting
> don't seem to get processed by SpamAssassin. This means I end up with
> about a half-dozen spam mails in my inbox every time I start up my machine
> after it's been off for a few hours.
>
> I suspect the problem is that my system loads the Fetchmail daemon first,
> and then the SpamAssassin daemon a few seconds later; in the few seconds
> that Fetchmail runs, it manages to download a dozen or so messages and
> pipes them to spamc, which can't connect to spamd and so passes the
> message through unchanged.

Yes, this sounds correct.

Use your system runlevel editor to change the order in which the daemons
are loaded. Fetchmail should be started fairly late in the boot-up
process.

> I thought the solution would be simply to use the -t argument to spamc to
> give it more time to connect to the spamd daemon. However, when I tried
> disabling spamd and then running
>
> cat some-email.txt | spamc -t x

This shouldn't make any difference as the default for -t is 600 seconds
(i.e 10 minutes, plenty of time on a normal system).

> from the command line, spamc didn't wait any longer no matter what value of
> x I used; it just waited for a second and then spit out some-email.txt
> as-is. Ditto when using the -x option.
>
> Am I doing anything wrong? Is there something besides fiddling with spamc
> arguments I can use to make sure fetchmail doesn't start running until
> spamd has started up? (I am running SuSE 9.3.)

Yes. See above. For SuSE I believe the command you need is Yast (though
I haven't used SuSE in some years, so my information may be outdated).

--
Neil.
If you aren't rich you should always look useful.
-- Louis-Ferdinand Celine

Re: fetchmail starts too fast for spamd

am 09.03.2006 10:16:11 von Tristan Miller

Greetings.

In article <87d5gwthp2.fsf@phun.phasmic.org>, Neil Woods wrote:
>> I suspect the problem is that my system loads the Fetchmail daemon
>> first, and then the SpamAssassin daemon a few seconds later; in the few
>> seconds that Fetchmail runs, it manages to download a dozen or so
>> messages and pipes them to spamc, which can't connect to spamd and so
>> passes the message through unchanged.
>
> Yes, this sounds correct.

Actually, turns out I was wrong. spamd is 21st on the list (S12), whereas
fetchmail is second-last at 34th (S15). Maybe spamd is just taking too
long to start up...?

Regards,
Tristan

--
_
_V.-o Tristan Miller [en,(fr,de,ia)] >< Space is limited
/ |`-' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= <> In a haiku, so it's hard
(7_\\ http://www.nothingisreal.com/ >< To finish what you

Re: fetchmail starts too fast for spamd

am 09.03.2006 10:58:17 von Andrzej Adam Filip

Tristan Miller writes:

> Greetings.
>
> In article <87d5gwthp2.fsf@phun.phasmic.org>, Neil Woods wrote:
>>> I suspect the problem is that my system loads the Fetchmail daemon
>>> first, and then the SpamAssassin daemon a few seconds later; in the few
>>> seconds that Fetchmail runs, it manages to download a dozen or so
>>> messages and pipes them to spamc, which can't connect to spamd and so
>>> passes the message through unchanged.
>>
>> Yes, this sounds correct.
>
> Actually, turns out I was wrong. spamd is 21st on the list (S12), whereas
> fetchmail is second-last at 34th (S15). Maybe spamd is just taking too
> long to start up...?

Have you considered using "wait for spamd" loop in fetchmail startup?
[ e.g. based on data reported by "fuser 789/tcp" ]

--
[pl2en Andrew] Andrzej Adam Filip : anfi@priv.onet.pl : anfi@xl.wp.pl
http://anfi.homeunix.net/