23 Feb 2007 15:24
Re: How to kill runsv, no matter what?
Alex Efros <powerman <at> powerman.asdfGroup.com>
2007-02-23 14:24:15 GMT
2007-02-23 14:24:15 GMT
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.
RSS Feed