From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/479 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 12:11:40 -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 1088179920 20521 80.91.224.253 (25 Jun 2004 16:12:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 25 Jun 2004 16:12:00 +0000 (UTC) Cc: supervision@list.skarnet.org Original-X-From: supervision-return-717-gcsg-supervision=m.gmane.org@list.skarnet.org Fri Jun 25 18:11:43 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 1BdtIk-0005Ky-00 for ; Fri, 25 Jun 2004 18:11:42 +0200 Original-Received: (qmail 12108 invoked by uid 76); 25 Jun 2004 16:12:04 -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 12102 invoked from network); 25 Jun 2004 16:12:03 -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:479 X-Report-Spam: http://spam.gmane.org/gmane.comp.sysutils.supervision.general:479 On Fri, 25 Jun 2004, Lloyd Zusman wrote: > Charlie Brady writes: > > >> [ ... ] > > > > 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" Why do you say they are the "right things"? Please re-read my previous message. runsv can already do what "apachectl" does, but more reliably, and using less resources. Why do you insist on using apachectl? > 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. No, that's just what "apachectl stop" does. > 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 Why do you want this extra shell process between runsv and apache, and why do you want to run apachectl? > I'm just not sure if this is the best way to accomplish what I want > to do. See below: > > 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. You now just need a run script which does: #! /bin/sh exec httpd ...... with the correct args. --- Charlie