From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/477 Path: main.gmane.org!not-for-mail From: Lloyd Zusman Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: Who actually gets the TERM signal in "runsvctrl down"? Date: Fri, 25 Jun 2004 12:03:13 -0400 Sender: news 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 1088179495 19091 80.91.224.253 (25 Jun 2004 16:04:55 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 25 Jun 2004 16:04:55 +0000 (UTC) Cc: Charlie Brady Original-X-From: supervision-return-715-gcsg-supervision=m.gmane.org@list.skarnet.org Fri Jun 25 18:04:42 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 1BdtBx-0004Zs-00 for ; Fri, 25 Jun 2004 18:04:41 +0200 Original-Received: (qmail 11861 invoked by uid 76); 25 Jun 2004 16:05:02 -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 11855 invoked from network); 25 Jun 2004 16:05:02 -0000 X-Injected-Via-Gmane: http://gmane.org/ Original-To: supervision@list.skarnet.org Original-Lines: 73 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: hippo.asfast.com User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.2 (gnu/linux) Cancel-Lock: sha1:6pqZwQ+5CwruWzxGk+PgGFnOhQo= Xref: main.gmane.org gmane.comp.sysutils.supervision.general:477 X-Report-Spam: http://spam.gmane.org/gmane.comp.sysutils.supervision.general:477 Charlie Brady writes: > On Fri, 25 Jun 2004, Lloyd Zusman wrote: >> >> [ ... ] >> >> 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". >> >> [ ... ] > > 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. Thanks. I'm already using runit, which I mentioned in my original message (that paragraph is quoted above). I understand how runsvctl works in relation to runit. I'm trying to figure out how to set up the "run" script in the apache service directory so that the "down" and "up" parameters to "runsvctrl" do the right things. By "right things" I mean (for apache): runsvctrl up apache => invoke "apachectl start" runsvctrl down apache => invoke "apachectl stop" [ actually, I already know how to do an "up" ... it's the "down" that I have a question about ] I don't want to send a TERM signal to httpd in order to stop it, because I want it to shut down using the same logic that "apachectl stop" uses, which is definitely not to simply send a TERM signal to the httpd daemon. To illustrate, here's an untested, quick and dirty version of the "run" script in the apache service directory which might do what I want: #!/bin/sh exec 2>&1 shutdown () { apachectl stop exit 0 } trap "shutdown" 15 apachectl start I'm just not sure if this is the best way to accomplish what I want to do. > 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. -- Lloyd Zusman ljz@asfast.com God bless you.