supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Alex Efros <powerman@powerman.asdfGroup.com>
To: supervision@list.skarnet.org
Subject: Re: How to kill runsv, no matter what?
Date: Fri, 23 Feb 2007 16:24:15 +0200	[thread overview]
Message-ID: <20070223142415.GR11107@home.power> (raw)
In-Reply-To: <20070223140504.17459.qmail@3f646761ee1f68.315fe32.mid.smarden.org>

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 $(<supervise/pid) )"
[[ -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

-- 
			WBR, Alex.


  reply	other threads:[~2007-02-23 14:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-21 20:14 Daniel Clark
2007-02-21 21:04 ` Daniel Clark
2007-02-23  3:51   ` Daniel Clark
2007-02-23 12:02     ` Laurent Bercot
2007-02-23 14:05     ` Gerrit Pape
2007-02-23 14:24       ` Alex Efros [this message]
2007-02-23 17:40         ` Daniel Clark
2007-02-23 17:32       ` Daniel Clark
2007-02-23 17:39         ` Paul Jarc
2007-02-23 17:46           ` Daniel Clark
2007-02-23 17:59             ` Paul Jarc
2007-02-23 18:25               ` Daniel Clark
2007-02-23 18:32                 ` Paul Jarc
2007-02-28 23:24                   ` Daniel Clark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070223142415.GR11107@home.power \
    --to=powerman@powerman.asdfgroup.com \
    --cc=supervision@list.skarnet.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).