Re: Funny spamd failure... (Maybe SARE/rules-du-jour related?)

2006-11-17 Thread Mark Martinec
Giampaolo,

> > These commands will only exit after they have completed their job,
> > i.e. waiting for the existing daemon to have stopped.

> ...So, I don't have a Linux distribution running on my servers?
> May you suggest to me the kind of OS brand I'm running?

Not sure what you are asking here. If you are asking for a recommendation
on OS of choice, this is a highly individual matter, often religious.
Use whatever you are comfortable with, and is being actively maintained.
We run almost entire servers fleet on FreeBSD, and happy with the choice.

> > Fiddling directly with pid file, kill, sleep, etc., is unwise,
> > and most likely much less careful compared to how amavisd does it.
>
> Hopefully, amavisd doesn't shuts or starts by itself.

No it doesn't. Also I never heard of a case where a master amavisd process
would vanish. For a quick overview on a general amavisd-new system health
I recommend running amavisd-nanny utility for a few seconds or minutes
every now an then, e.g. once a day or when there is suspicion that
things are busier or slower then expected.

  Mark


RE: Funny spamd failure... (Maybe SARE/rules-du-jour related?)

2006-11-17 Thread Giampaolo Tomassoni
> > The guy who made the script did simply test shutting and restarting the
> > amavis/spamd daemon up and down in its own test environment, 
> which basicly
> > is low mail load or even no mail at all.
> >
> > After a while amavis is doing it's dirty job, I noticed it 
> needs a lot of
> > time to shut down. It takes to me something around 10 secs in 
> the average
> > and sometimes it takes even more. So, a 'sleep 5' simply wouldn't fit.
> 
> To shut down amavisd, use the command: amavisd stop
> To restart amavisd, use the command:   amavisd reload
> 
> These commands will only exit after they have completed their job,
> i.e. waiting for the existing daemon to have stopped.

Ah, Mark. Really many many thanks for this perl of wisdom.

So, I don't have a Linux distribution running on my servers?

May you suggest to me the kind of OS brand I'm running?


> Fiddling directly with pid file, kill, sleep, etc., is unwise,
> and most likely much less careful compared to how amavisd does it.

Hopefully, amavisd doesn't shuts or starts by itself.

It even installs by itself...


>   Mark

giampaolo



Re: Funny spamd failure... (Maybe SARE/rules-du-jour related?)

2006-11-17 Thread Mark Martinec
> The guy who made the script did simply test shutting and restarting the
> amavis/spamd daemon up and down in its own test environment, which basicly
> is low mail load or even no mail at all.
>
> After a while amavis is doing it's dirty job, I noticed it needs a lot of
> time to shut down. It takes to me something around 10 secs in the average
> and sometimes it takes even more. So, a 'sleep 5' simply wouldn't fit.

To shut down amavisd, use the command: amavisd stop
To restart amavisd, use the command:   amavisd reload

These commands will only exit after they have completed their job,
i.e. waiting for the existing daemon to have stopped.

Fiddling directly with pid file, kill, sleep, etc., is unwise,
and most likely much less careful compared to how amavisd does it.

  Mark


RE: Funny spamd failure... (Maybe SARE/rules-du-jour related?)

2006-11-17 Thread Giampaolo Tomassoni
From: Peter H. Lemieux [mailto:[EMAIL PROTECTED]
> Giampaolo Tomassoni wrote:
> > # Check for amavis termination
> > while [[ ! -z "${PIDS}" ]]; do
> > sleep 1
> > PIDS=$( /sbin/pidof "${AMV_NM}" )
> > done
> 
> In cases like this I usually just put the "sleep" command in the init 
> script like this:
> 
> ...
> 
> case "$1" in
> ...
> 
>restart|reload)
>  stop
>   sleep 5  <=
>  start
>  RETVAL=$?
>  ;;
> 
> ...
> 
> I'm not a gentoo user, though, so YMMV.  I'm using RedHat/CentOS.  Still 
> I'd bet the init scripts aren't that different.

The init script fails because it uses something like your way: a single sleep 5 
:)

The guy who made the script did simply test shutting and restarting the 
amavis/spamd daemon up and down in its own test environment, which basicly is 
low mail load or even no mail at all.

After a while amavis is doing it's dirty job, I noticed it needs a lot of time 
to shut down. It takes to me something around 10 secs in the average and 
sometimes it takes even more. So, a 'sleep 5' simply wouldn't fit.

I don't know why (and I even don't care to know), but the script I'm using 
introduces a delay of at most 1 more sec than the strictly needed in restarting 
amavis and it never failed to me.

Giampaolo


> 
> Peter



Re: Funny spamd failure... (Maybe SARE/rules-du-jour related?)

2006-11-17 Thread Peter H. Lemieux

Giampaolo Tomassoni wrote:

# Check for amavis termination
while [[ ! -z "${PIDS}" ]]; do
sleep 1
PIDS=$( /sbin/pidof "${AMV_NM}" )
done


In cases like this I usually just put the "sleep" command in the init 
script like this:


...

case "$1" in
...

  restart|reload)
stop
sleep 5  <=
start
RETVAL=$?
;;

...

I'm not a gentoo user, though, so YMMV.  I'm using RedHat/CentOS.  Still 
I'd bet the init scripts aren't that different.


Peter


RE: Funny spamd failure... (Maybe SARE/rules-du-jour related?)

2006-11-17 Thread Giampaolo Tomassoni
> The other night my default gentoo RulesDuJour for Spamassassin 
> acquired new
> Adult and General rule-sets from SARE.  Thereafter spamd refused all
> connections and subsequently received mail was not spam filtered. 
> Issuing '/etc/init.d/spamd restart' as root resolved the situation...
> but I don't want to have to do this every time a rule-set is
> automatically updated overnight.
> 
> This is a (sanitised) extract from /var/log/messages :
> 
> ...omissis...
>
> 
> Does anyone else have this problem?  Can it be attributed to fcron or
> RulesDuJour or something peculiar to my setup?
> I don't understand the "process already running" messages from fcron -
> but my cron jobs all seem to be executed normally.

Yep! That's a well-known issue to me, but with amavis.

When the rulesdujour script issues a '/etc/init.d/amavis restart', the gentoo's 
init script doesn't  wait enough for amavis termination and times out. I had to 
overcame the problem by configuring ruledujour to restart amavis through a 
simple, my-hand-made, script.

That's it:

#!/bin/bash
AMV_NM=amavisd
AMV_RC=/etc/init.d/amavisd

# Get the amavis' processes pids
PIDS=$( /sbin/pidof "${AMV_NM}" )
if [[ ! -z "${PIDS}" ]]; then
# Stop amavis
"${AMV_RC}" stop

# Check for amavis termination
while [[ ! -z "${PIDS}" ]]; do
sleep 1
PIDS=$( /sbin/pidof "${AMV_NM}" )
done

# (Re)start amavis
"${AMV_RC}" restart
fi

Please note that, since the "stop" action is prone to fail, you can't just use 
a "start" action later. Use a "restart" instead: it will detect amavis as not 
running anymore and will start it as required.

Of course, this script may be adapted to your needs: simply set AMV_NM e AMV_RC 
to the name and init script's path of spamd.

Regards,

giampaolo

> 
> The script which was run immediately prior to spamd stopping 
> accepting connections is the standard one supplied for Gentoo - a 
> copy of the version I'm using is here : 
http://temporary.shic.dynalias.net/rules_du_jour

--