https://github.com/nickstenning/undaemonize
A tiny utility to undaemonize misbehaving programs
https://github.com/nickstenning/undaemonize
daemon linux system-programming
Last synced: 10 months ago
JSON representation
A tiny utility to undaemonize misbehaving programs
- Host: GitHub
- URL: https://github.com/nickstenning/undaemonize
- Owner: nickstenning
- License: mit
- Created: 2017-02-09T13:56:40.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-09T13:58:43.000Z (almost 9 years ago)
- Last Synced: 2025-01-04T07:52:31.460Z (12 months ago)
- Topics: daemon, linux, system-programming
- Language: C
- Homepage:
- Size: 2.93 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
undaemonize
===========
This is a tiny helper utility to force programs which insist on daemonizing
themselves to run in the foreground.
It's like djb's [fghack][1], except it's not a hack, because it makes use of the
`PR_SET_CHILD_SUBREAPER` flag added to `prctl(2)` in version 3.4 of the Linux
kernel. To quote [the documentation][2]:
When a process is marked as a child subreaper, all of the children that it
creates, and their descendants, will be marked as having a subreaper. In
effect, a subreaper fulfills the role of init(1) for its descendant
processes. Upon termination of a process that is orphaned (i.e., its
immediate parent has already terminated) and marked as having a subreaper,
the nearest still living ancestor subreaper will receive a SIGCHLD signal
and will be able to wait(2) on the process to discover its termination
status.
[1]: https://cr.yp.to/daemontools/fghack.html
[2]: http://man7.org/linux/man-pages/man2/prctl.2.html
Usage
-----
undaemonize foobard -f /etc/foobard.conf
Installation
------------
make
sudo install -o root -g root -m 755 undaemonize /usr/local/bin
Caveats
-------
`undaemonize` does not (currently) forward signals to its child processes. If
you kill `undaemonize`, the daemon will not be killed.
License
-------
`undaemonize` is released under the MIT license. See `LICENSE`.