From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/1382 Path: news.gmane.org!not-for-mail From: "Daniel Clark" Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: How to kill runsv, no matter what? Date: Fri, 23 Feb 2007 12:40:14 -0500 Message-ID: <5422d5e60702230940u2406283aocebba1878e0d7d60@mail.gmail.com> References: <5422d5e60702211214q7ecaf23co838e9ff1b9be32de@mail.gmail.com> <5422d5e60702211304g5051747aoad3dd893abaf0b16@mail.gmail.com> <5422d5e60702221951h1abb7e60l77717192900a63a8@mail.gmail.com> <20070223140504.17459.qmail@3f646761ee1f68.315fe32.mid.smarden.org> <20070223142415.GR11107@home.power> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1172252436 16455 80.91.229.12 (23 Feb 2007 17:40:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 23 Feb 2007 17:40:36 +0000 (UTC) To: supervision@list.skarnet.org Original-X-From: supervision-return-1618-gcsg-supervision=m.gmane.org@list.skarnet.org Fri Feb 23 18:40:20 2007 Return-path: Envelope-to: gcsg-supervision@gmane.org Original-Received: from antah.skarnet.org ([212.85.147.14]) by lo.gmane.org with smtp (Exim 4.50) id 1HKeP3-0001UE-UF for gcsg-supervision@gmane.org; Fri, 23 Feb 2007 18:40:18 +0100 Original-Received: (qmail 17319 invoked by uid 76); 23 Feb 2007 17:40:39 -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 17314 invoked from network); 23 Feb 2007 17:40:39 -0000 DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=ImsM6laTDy0pT0Cz5gKn9qydoQV/Yp9/oOpNQEDv0hRElPsSVpQw+uvvXdEC+TbkX91IO3u02ERtwY3eaB8D6XQp+6pe1hTrs8+fZsD7wEPMgeE+1MHut8FDLw/rNRBHn9qSxyHKAssw8g8QG51AglMoNoJcD/uJ3Gk2w/CDfkM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=YADVeEShxc9J6FCnaZCgBr0zK4lmsayZfC+egnIKSHS+faaSjpFZTYQMoj5HMyZUSi1yXmzrYThTDfLIC8urHcC5Bk7fS3LwvJIvwuJZb2HyWPi0wjtDKyLDmjm8Z+de6u64v9y0yk7j1x4waVIbFFKOVjs7W3acSSn1l56mUgw= Original-Sender: djbclark@gmail.com In-Reply-To: <20070223142415.GR11107@home.power> Content-Disposition: inline X-Google-Sender-Auth: ac702fdb5f35f981 Xref: news.gmane.org gmane.comp.sysutils.supervision.general:1382 Archived-At: On 2/23/07, Alex Efros wrote: > Hi! > > On Fri, Feb 23, 2007 at 02:05:03PM +0000, Gerrit Pape wrote: > > to exit, it sends the service (the ./test1-sv.sh shell script) a TERM > > signal, the shell script terminates (fine), but is leaving behind the > > There one another similar issue: if service run interactive bash > (getty-like services) then it also will not stop. > > # sv t getty1 > > send SIGTERM while bash require SIGHUP or SIGKILL instead of SIGTERM. > Moreover, if you run mc - it will run it's own bash which also should > be killed to restart getty service... and same is true for things like su. > To solve this I create script /usr/local/bin/term-getty-service: > > ---cut--- > #!/bin/bash > bashs() { while [[ -n "$1" ]]; do pgrep -P $1 bash; bashs $(pgrep -P $1); shift; done; } > bashs="$( bashs $( [[ -n "$bashs" ]] && kill -HUP $bashs > exit 1 # runsv must send TERM to getty if user don't logged in this console > ---cut--- > > You should create symlink to it from service's ./control/t: > > # ln -s /usr/local/bin/term-getty-service \ > /var/service/getty-tty1/control/t That looks very inventive (and dense :-), but not very cross-platform, which is the primary reason I am interested in runit (e.g. I want to maintain non-vendor services on AIX, GNU/Linux, Solaris, *BSD etc. in the same way -- many of these systems don't come standard with bash). Perhaps a "kill with extreme prejudice" type flag implemented in the runit code itself is in order? I really like to have commands available that are deterministic (e.g. if I tell sv to kill something with this flag, it dies, don't pass go, don't collect $200) -- Daniel Clark # http://dclark.us # http://opensysadmin.com