Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for signal "observers" #207

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jhriggs
Copy link

@jhriggs jhriggs commented May 12, 2020

  • Add an optional third parameter to -r/--rewrite (-r s:r[:observer]) that specifies a script/executable that should be called when signal s is received (whether or not it is forwarded).
  • The observer may be specified as a full path or PATH will be searched.
  • The observer is called without any arguments, but the signal and replacement are provided by the DUMB_INIT_SIGNUM and DUMB_INIT_REPLACEMENT_SIGNUM environment variables, respectively.
  • The intention is that the observer has no impact on dumb-init or the child process(es), for example if it exits with failure. It is simply an observer.

I desperately need this for a Nomad environment. When template files get automatically updated by service discovery or key-value changes, the only notification options are to restart the app/container (not good for this case) or signals; however, the process I am using does not have special signal-handling I need. So, I want to intercept the signal and execute a custom script ("observer").

Note: I am no expert with signal handling or fork+exec, so feel free to fix (and teach me)! The same goes for the tests I added which are very much a cut+paste job. :-)

- Add an optional third parameter to -r/--rewrite (-r s:r[:observer]) that specifies a script/executable that should be called when signal s is received (whether or not it is forwarded).
- The observer may be specified as a full path or PATH will be searched.
- The observer is called without any arguments, but the signal and replacement are provided by the DUMB_INIT_SIGNUM and DUMB_INIT_REPLACEMENT_SIGNUM environment variables, respectively.
- The intention is that the observer has no impact on dumb-init or the child process(es), for example if it exits with failure. It is simply an observer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant