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


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to