From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/492 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 23:01: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 1088218906 7182 80.91.224.253 (26 Jun 2004 03:01:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 26 Jun 2004 03:01:46 +0000 (UTC) Cc: Charlie Brady Original-X-From: supervision-return-730-gcsg-supervision=m.gmane.org@list.skarnet.org Sat Jun 26 05:01:40 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 1Be3Rj-0003ah-00 for ; Sat, 26 Jun 2004 05:01:39 +0200 Original-Received: (qmail 18341 invoked by uid 76); 26 Jun 2004 03:02:00 -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 18335 invoked from network); 26 Jun 2004 03:02:00 -0000 X-Injected-Via-Gmane: http://gmane.org/ Original-To: supervision@list.skarnet.org Original-Lines: 62 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:Ysvuqmdi5xm0nIFydEXt/RxU4Uc= Xref: main.gmane.org gmane.comp.sysutils.supervision.general:492 X-Report-Spam: http://spam.gmane.org/gmane.comp.sysutils.supervision.general:492 I just answered my own question. See below ... Lloyd Zusman writes: > Charlie Brady writes: > >> On Fri, 25 Jun 2004, Lloyd Zusman wrote: >> >> [ ... ] >> >> Being started and being restarted are both covered by what is done in the >> run script. If you need something special done when you stop a daemon >> (which usually is not the case), then with runit you can provide a >> "finish" script. > > But look more carefully at the script fragment I wrote in the previous > message: I want to do something different between "restart" and > "graceful" ... > > restart: before sending the signal to httpd, clean up some > subdirectories under /tmp that are used in certain web apps > on my site; and only _then_ send the signal to httpd (do > this before "start", also, but that's a trivial case) > > graceful: just send the signal to httpd and _do_ _not_ clean up any > directories, because in apache, a "graceful" restart keeps > connections open, etc., and I don't want existing > data to be lost > > How do I cause my /tmp directories to get cleaned up during "restart", > but not during "graceful"? Hmm ... maybe I can do it this way (almost the same as what you had suggested, but with a slight difference for "graceful") ... Use something akin to your suggested "run" script ... #! /bin/sh exec 2>&1 do_your_cleanup_stuff TZ=xxxxx exec chpst -P /usr/sbin/httpd -DNO_DETACH Then ... start: runsvctrl u apache (causes cleanup stuff to run) stop: runsvctrl d apache (no cleanup stuff gets run) graceful: runsvctrl 1 apache (no cleanup stuff gets run) restart: runscvtrl t apache; runsvctrl u apache (causes cleanup stuff to run during the second command) -- Lloyd Zusman ljz@asfast.com God bless you.