The problem with the soft kill is that, as you say in your message, it takes
some time for all connections to come to a graceful conclusion and then
you're still often left with some that hang.  Unfortunately our mail server
is in production offering both smtp and pop services for thousands of
customers.  When our mail server hangs, people start screaming.  We need to
un-hinge it and get it back up and running again.  I would love to
understand what is causing smtp and pop to hang up.  But, meanwhile, I need
to quickly kill qmail and tcpserver and get them started again.  Sounds like
pkill without the "-u 0" is the answer.  My original question was why this
startup script would kill only the root owned processes.

BTW,  I would be interested in a discussion of the political and theoretical
issues involved in stopping qmail outright, since, until I can figure out
why qmail is hanging on our system, I must apparently stop it outright to
get it up and running again.  And political and theoretical rammifications
must be taken into consideration (even if they are overridden by necessity).

Thanks,

Mike

> -----Original Message-----
> From: Mark Mentovai [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 13, 2000 3:38 PM
> To: [EMAIL PROTECTED]
> Subject: RE: qmail hanging - best way to restart
>
>
> Mike Denka wrote, among other things:
> >        /usr/bin/pkill -f -u 0 qmail-smtpd
> >        /usr/bin/pkill -f -u 0 qmail-send
> >        /usr/bin/pkill -f -u 0 qmail-lspawn
> >        /usr/bin/pkill -f -u 0 qmail-rspawn
> >        /usr/bin/pkill -f -u 0 qmail-clean
> >        /usr/bin/pkill -f -u 0 splogger
>
> I'll spare the discussion of the merits of stopping qmail outright (as you
> are attempting to do) vs. letting it stop.  That's a more theoretical and
> political issue.
>
> -u 0 is your answer to your euid==0 question.  Check the man page.  The -u
> option to pkill restricts it to processes with a certain effective UID.
> Take it out.
>
> Actually, you're killing too many unnecessary things and too few necessary
> things.  To hard-stop the SMTP server, send a SIGTERM to tcpserver and
> qmail-smtpd.  To hard-stop qmail, send a SIGTERM to qmail-send and all
> delivery programs (qmail-remote, qmail-local, and any local delivery agent
> like procmail).
>
> pkill isn't portable.  Assuming you're OK with that, and that you'll
> continue to launch qmail as you have been (without supervise from
> daemontools), AND that you want to hard-stop qmail, you should do the
> following:
>
>   # Stop delivering mail, deliveries in progress will continue
>   pkill -TERM -u qmails qmail-send
>   # Stop accepting SMTP connections, open connections will remain
>   pkill -TERM -u qmaild tcpserver
>
> If left alone long enough, deliveries and SMTP connections would then
> finish.  This is what I refer to as a soft stop.  For a hard
> stop, possibly
> after sleeping for a while to give deliveries a fair chance:
>
>   # Stop local deliveries in progress - don't specify -u due to setuid
>   # Messages will remain in queue
>   pkill -TERM '(qmail-local|procmail)'
>   # Stop remote deliveries in progress
>   # Messages will remain in queue
>   pkill -TERM -u qmailr qmail-remote
>   # Stop SMTP connections in progress
>   # MTAs will queue mail and try again.  MUAs should do the same, but
>   #  may warn the user.
>   pkill -TERM -u qmaild qmail-smtpd
>
> Mark
>
> --
> Do not reply directly to this e-mail address
> --
> Mark Mentovai
> GGN NOC System Administrator
>
>

Reply via email to