[Dovecot] Graceful shutdown
Hello all,
I am running Dovecot v1alpha4 on Fedora 4 from the command line (as opposed to deamon). Is there a recommended way to shut it down gracefully? Or do I just use killall -9 dovecot? I'm not using the included version, so I can't do SERVICE DOVECOT STOP.
Thanks,
Cliff
--On Monday, November 28, 2005 12:13 PM -0600 Cliff Hayes chayes@afo.net wrote:
I am running Dovecot v1alpha4 on Fedora 4 from the command line (as opposed to deamon). Is there a recommended way to shut it down gracefully? Or do I just use killall -9 dovecot? I'm not using the included version, so I can't do SERVICE DOVECOT STOP.
The "service dovecot stop" issues "killproc dovecot" which is a macro that issues "kill -TERM" against its PID, waits up to 5 seconds for the pid file to go away, and issues "kill -KILL" if it still exists. (See /etc/init.d/dovecot and /etc/init.d/functions.)
Kenneth,
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.
There is no /etc/init.d/dovecot directory.
Cliff
-----Original Message----- From: dovecot-bounces@dovecot.org [mailto:dovecot-bounces@dovecot.org]On Behalf Of Kenneth Porter Sent: Monday, November 28, 2005 4:34 PM To: dovecot@dovecot.org Subject: Re: [Dovecot] Graceful shutdown
--On Monday, November 28, 2005 12:13 PM -0600 Cliff Hayes chayes@afo.net wrote:
I am running Dovecot v1alpha4 on Fedora 4 from the command line (as opposed to deamon). Is there a recommended way to shut it down gracefully? Or do I just use killall -9 dovecot? I'm not using the included version, so I can't do SERVICE DOVECOT STOP.
The "service dovecot stop" issues "killproc dovecot" which is a macro that issues "kill -TERM" against its PID, waits up to 5 seconds for the pid file to go away, and issues "kill -KILL" if it still exists. (See /etc/init.d/dovecot and /etc/init.d/functions.)
--On Wednesday, November 30, 2005 3:42 PM -0600 Cliff Hayes chayes@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.
participants (2)
-
Cliff Hayes
-
Kenneth Porter