From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/476 Path: main.gmane.org!not-for-mail From: Charlie Brady Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: Who actually gets the TERM signal in "runsvctrl down"? Date: Fri, 25 Jun 2004 11:33:41 -0400 (EDT) Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: sea.gmane.org 1088177651 12917 80.91.224.253 (25 Jun 2004 15:34:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 25 Jun 2004 15:34:11 +0000 (UTC) Cc: supervision@list.skarnet.org Original-X-From: supervision-return-714-gcsg-supervision=m.gmane.org@list.skarnet.org Fri Jun 25 17:33:46 2004 Return-path: Original-Received: from antah.skarnet.org ([212.85.147.14]) by deer.gmane.org with smtp (Exim 3.35 #1 (Debian)) id 1Bdsi1-000146-00 for ; Fri, 25 Jun 2004 17:33:45 +0200 Original-Received: (qmail 11682 invoked by uid 76); 25 Jun 2004 15:34:06 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 11676 invoked from network); 25 Jun 2004 15:34:06 -0000 X-X-Sender: charlieb@e-smith.charlieb.ott.istop.com Original-To: Lloyd Zusman In-Reply-To: Xref: main.gmane.org gmane.comp.sysutils.supervision.general:476 X-Report-Spam: http://spam.gmane.org/gmane.comp.sysutils.supervision.general:476 On Fri, 25 Jun 2004, Lloyd Zusman wrote: > Who actually receives the TERM signal when "runsvctrl down SVC" is > invoked? Does that signal get sent to the SVC/run script? Correct. Or more correctly, the inheritor of that process, presumably an apache instance started by exec. > The reason I'm asking is that I'm trying to put apache under runit > control. I'd like "runsvctrl up apache" to invoke "apachectl start" > (that's trivially easy), and I'd like "runsvctrl down apache" to invoke > "apachectl stop". > > If the TERM signal gets sent to the SVC/run script, then I can write a > trap for that signal within that script which would cause > "apachectl stop" to be invoked, thereby providing a clean shutdown. > > Or is there a better way to do this? The better way is runit/daemontools. runsvctrl is just a shell script which tries to do what runsv is already able to do reliably. It delivers a signal to the session leading httpd process, which it has hopefully found by way of a pid file. That process then "does the right thing" with its children. For "apachectl stop", just do "runsvctrl down apache". For "apachectl graceful", do "runsvctrl 1 apache; raunsvctrl u apache". For "apachectrl restart", do "runsvctrl t apache; raunsvctrl u apache". Etc. --- Charlie