[Dovecot] Graceful shutdown

Kenneth Porter shiva at sewingwitch.com
Thu Dec 1 00:07:09 EET 2005


--On Wednesday, November 30, 2005 3:42 PM -0600 Cliff Hayes 
<chayes at afo.net> wrote:

> I wasn't able to get that to work.
>
> I did "killproc dovecot" and got:  killproc cannot be found.
>
> The only place I found it was inside of /etc/init.d/functions as you
> mentioned below.  I don't know how to use it that way.

You have to invoke it from a shell script that "sources" the functions file 
(which is a library used by initscripts).

> There is no /etc/init.d/dovecot directory.

No, that's the initscript installed by the Fedora dovecot package. (In 
fact, /etc/init.d is a symlink to the "real" directory at /etc/rc.d/init.d.)

> I am running Dovecot v1alpha4 on Fedora 4 from the command line (as
> opposed to deamon).

Why from the command line? Why not use an initscript?

In any case, look at the definition of killproc() and implement a similar 
script. That function depends on the existence of a pid file, though. It 
issues "kill -TERM" a couple of times, sleeping if that doesn't remove the 
pid file or cause that process to exit. If repeated -TERM attempts fail 
(suggesting a hung process), it uses the big hammer and hits it with "kill 
-KILL" (AKA -9), which bypasses the process' signal handlers and shuts it 
down without giving it any opportunity to clean up.


More information about the dovecot mailing list