tj / mon

mon(1) - Simple single-process process monitoring program written in C
1.08k stars 94 forks source link

using pipe in command results in SIGTERM not being sent #37

Open kilianc opened 9 years ago

kilianc commented 9 years ago

related to #36

I have something like "node server.js | rtail --id api-dev" as mon command and SIGTERM never gets to the node process.

marcbachmann commented 9 years ago

It would be awesome if this works. This works:

$ mon "docker run -i ubuntu /bin/bash" --pidfile ubuntu.pid --mon-pidfile mon.pid
$ kill -TERM $(cat mon.pid)

But this isn't working:

$ mon "docker run -it -p 9200:9200 -p 9300:9300 digitalwonderland/elasticsearch" --pidfile elastic.pid --mon-pidfile mon.pid
$ kill -TERM $(cat mon.pid)
kilianc commented 9 years ago

I think this may be related to a missing pipefail option. I probably need to use bash -c -o pipefail "node server.js | rtail --id api-dev" to make it work

marcbachmann commented 9 years ago

Yes. In both cases the SIGTERM signal isn't handled. Nearly the same problem I have with docker.