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