bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pipeline outlives TERMed bash


From: Chet Ramey
Subject: Re: pipeline outlives TERMed bash
Date: Wed, 14 Sep 2005 11:21:39 -0400
User-agent: Mozilla Thunderbird 1.0.6 (Macintosh/20050716)

Denis Vlasenko wrote:
> Hi!
> 
> I want to run this script continuously under supervise
> (a tool for daemontools package):
> 
> user=daemon
> exec env - \
> softlimit \
> setuidgid "$user" \
> nmeter t c l i p lf b nifi nife d60000' \
> | logger -t ''
> 
> nmeter prints lines like this:
> 
> 14:31:00 [UU........] int  63k f 100 bio  96k  11M ifi  81k 1.1M ife 879k 192k
> 
> every minute, and I want them to be logged in syslog.
> 
> This works. However, I also want to be able to stop/[re]start
> this script using daemontools' standard utility, svc:
> 
> svc -d: sends a TERM to running daemon
> svc -u: starts daemon if it is not running
> 
> The problem is that svc -d (or manual kill -TERM)
> kills bash but nmeter and logger continue to run,
> until I kill nmeter manually.

Bash doesn't turn around and kill its running children if it gets
a SIGTERM.  You need to figure out how to get the process group
signalled, as it is when you type ^C at the keyboard.

Maybe something like trap 'kill -s TERM -$$; exit 1' SIGTERM will work.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                                Live Strong.
Chet Ramey, ITS, CWRU    address@hidden    http://tiswww.tis.case.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]