[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
pipeline outlives TERMed bash
From: |
Denis Vlasenko |
Subject: |
pipeline outlives TERMed bash |
Date: |
Wed, 14 Sep 2005 14:39:31 +0300 |
User-agent: |
KMail/1.8.2 |
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.
(NB: running this script manually and pressing ctrl-C
kills all three processes. You need to kill bash
from another terminal to see this happen)
I need to run this crawling horror:
user=daemon
trap 'sh exit.sh' EXIT
sh -c 'echo kill $$ >exit.sh
exec env - \
softlimit \
setuidgid '"$user"' \
nmeter t c l i p lf b nifi nife d60000' \
| logger -t '' &
wait
to get behaviour I want.
Is there a saner solution?
--
vda
- pipeline outlives TERMed bash,
Denis Vlasenko <=