From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/481 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:36:50 -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 1088181472 25366 80.91.224.253 (25 Jun 2004 16:37:52 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 25 Jun 2004 16:37:52 +0000 (UTC) Cc: Charlie Brady Original-X-From: supervision-return-719-gcsg-supervision=m.gmane.org@list.skarnet.org Fri Jun 25 18:37: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 1Bdtht-0007uv-00 for ; Fri, 25 Jun 2004 18:37:42 +0200 Original-Received: (qmail 12469 invoked by uid 76); 25 Jun 2004 16:38: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 12463 invoked from network); 25 Jun 2004 16:38:02 -0000 X-Injected-Via-Gmane: http://gmane.org/ Original-To: supervision@list.skarnet.org Original-Lines: 79 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:Qn0GQot+vfsMdwNTMxZz7Es/+uI= Xref: main.gmane.org gmane.comp.sysutils.supervision.general:481 X-Report-Spam: http://spam.gmane.org/gmane.comp.sysutils.supervision.general:481 Charlie Brady writes: > On Fri, 25 Jun 2004, Lloyd Zusman wrote: > > [ ... ] > >> 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? See below. >> 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. Here's the code fragment within "apachectl" on my system that handles the "stop" argument: case $ARGV in start|stop|restart|graceful) $HTTPD -k $ARGV ERROR=$? ;; ... etc. ... esac Therefore, an "apachectl stop" causes "httpd -k stop" to be invoked. Does passing "-k stop" to httpd cause it to signal itself with TERM? If so, can we count on that in all versions of apache? This is Apache 2.0.48, by the way, in case that makes any difference. >> [ ... ] > > Why do you want this extra shell process between runsv and apache, and > why do you want to run apachectl? Because I want to use the software's own recommended startup and shutdown procedures when I invoke it and kill it. It might be that in the specific case of apache, I can safely strip out all of the wrapper stuff that its startup script (apachectl) provides, but in the general case, I can't always count on this working. I'd rather rely on startup and shutdown scripts that are supplied with the various software packages that I use. But I want to control them via runit mechanisms. The amount of extra time that is used to start up and stop a long-running daemon like apache by invoking its recommended wrapper script inside of "run" is infinitessimal in relation to the daemon's lifetime. > [ ... ] > >> > 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. -- Lloyd Zusman ljz@asfast.com God bless you.