Commit graph

29 commits

Author SHA1 Message Date
Mike McClurg
d57a38b0c1 Print debug output when translating signal 2016-06-19 15:24:34 -07:00
Chris Kuehl
b678dbf4b3 Fix segfault on invalid arguments 2016-06-17 10:20:05 -07:00
Chris Kuehl
1a7c635071 Add ability to ignore signals 2016-06-14 11:34:52 -07:00
Chris Kuehl
554760fda6 Use signal rewriting for TTY signal special cases 2016-06-14 11:08:33 -07:00
Chris Kuehl
9e456addb7 Add signal translation tests 2016-06-13 14:33:51 -07:00
Mike McClurg
6f6b51f869 Rewrite arbitrary signals, and update tests
We've decided to allow arbitrary signal rewriting, not just SIGTERM
rewriting. To use, call dumb-init with the '-r s:r' option, which will
rewrite signum s to signum r. Only signals 1-31 are allowed to be
rewritten, which should cover all the signals we need to cover.

Note that this commit does not add new tests, it only fixes the existing
broken test.
2016-06-09 16:05:27 -06:00
Mike McClurg
3b6e9f256f Add '--signal' option to replace SIGTERM
Many servers respond to other signals than SIGTERM for their "soft
shutdown" option, such as Unicorn which requires SIGQUIT to wait on
outstanding connections. The 'docker stop' command sends the SIGTERM
signal to the container, and provides no option for modifying this
behavior. The 'docker kill' command has an '-s' option which allows one
to modify the signal sent to the container, but orchestration frameworks
such as Mesos don't provide a way to use this functionality.

This commit adds the '-s/--signal' option to dumb-init, which provides a
replacement signal for SIGTERM. For instance, running dumb-init like so:

  dumb-init -s 3 <command>

Will send SIGQUIT (3) to the <command> process it spawns when it
receives a SIGTERM. This allows Docker image writers the freedom to
specify how SIGTERM will behave in their containers.

A further improvement to this option could be to provide an arbirary
mapping from signal to signal, but that would greatly complicate the
code for a probably minor use case.
2016-06-08 16:20:57 -06:00
Chris Kuehl
b7aee39721 Fix incorrect error on bad exec when passing args 2016-05-28 02:03:19 -04:00
Chris Kuehl
256edaef74 Simplify dumb-init behavior using sigwait 2016-04-29 17:13:52 -07:00
Chris Kuehl
d626878a0c Fix exit status when process exits via signal
This fixes https://github.com/Yelp/dumb-init/issues/59
2016-03-11 13:42:00 -08:00
Chris Kuehl
3582a92402 Fix typo in error message 2015-11-20 09:31:45 -08:00
Chris Kuehl
01f6064164 Fix typo in help message 2015-10-26 10:20:18 -07:00
Anthony Sottile
d0c28bd03e Descendants not ancestors 2015-10-02 22:28:40 -07:00
Chris Kuehl
6b7f0ce3fa Add standard command-line flags 2015-10-02 15:53:07 -07:00
Chris Kuehl
316f6b0d93 Prefix output with [dumb-init] 2015-10-02 10:51:09 -07:00
Chris Kuehl
2aa56d6aab Merge pull request #25 from chriskuehl/background-support
Properly respond to job control signals
2015-09-29 13:44:28 -07:00
Chris Kuehl
d178fbaf52 Print better error message when exec fails 2015-09-29 10:49:08 -07:00
Chris Kuehl
a78ac8fe23 Exit nonzero if exec fails 2015-09-29 10:43:45 -07:00
Chris Kuehl
b39643dcbc Properly respond to job control signals 2015-09-25 18:19:23 -07:00
Chris Kuehl
d59a190a5d Send TERM to all children when the main child exists in setsid mode 2015-09-16 20:00:15 -07:00
Chris Kuehl
6e2b2eee00 Properly reap zombie processes 2015-09-10 17:28:39 -07:00
Kent Wills
d5f0be96d3 update docstrings, fix itest, add to dockerignore 2015-09-10 15:34:09 -07:00
Kent Wills
1b816df1b6 change setpgid to setsid 2015-09-10 15:34:09 -07:00
Chris Kuehl
4bc0d0abd6 README: update for process group support 2015-09-04 13:14:00 -07:00
Buck Golemon
d0e9a8d02a buck review 2015-08-28 18:21:51 -07:00
Chris Kuehl
807db9be27 Add process group support 2015-08-28 09:25:10 -07:00
Chris Kuehl
129e39af34 Whitespace cleanup 2015-08-10 09:32:56 -07:00
Chris Kuehl
2c3b93a86e Fix return code, add better help, add more tests 2015-08-06 14:31:49 -07:00
Chris Kuehl
ad20525ad9 Initial commit 2015-08-04 16:38:35 -07:00