3 ms·
There's plenty of successors to daemontools following the same principles, but more advanced: s6, nosh, perp, runit, etc. That said, from what I know systemd d
by vezzy-fnord 11y ago
There's plenty of successors to daemontools following the same principles, but more advanced: s6, nosh, perp, runit, etc.
That said, from what I know systemd doesn't necessarily handle double-forking daemons any better. That is to say, if you set the service to Type=forking, it'll still need to use a PID file (with its inherent race conditions) or employ a PID guessing heuristic, which can fail.
This is a universal problem that no hack can truly solve. The bottom line is if you're running under a service manager, you don't daemonize. You delegate to the service manager to daemonize for you. Any deviation from this will be finicky on most Unix-likes.
The purpose of cgroups here is instead process tracking, i.e. reliably killing all children. But for some services this is exactly what you don't want, and then there's nothing stopping you from allocating cgroups yourself if needed, or talk to a cgroup hierarchy management daemon like cgmanager. Ultimately, you just want some unit of isolation here, so you can use whatever your platform has, i.e. jails or contracts.
- thwarted 11y agoOne little known feature added in Linux 3.4 is the PR_SET_CHILD_SUBREAPER prctl(2) [0] that lets you designate the process as being a "subreaper" and it will be notified of any descending subprocess exits, just like init would be. [0] http://man7.org/linux/man-pages/man2/prctl.2.html http://man7.org/linux/man-pages/man2/prctl.2.html
- vezzy-fnord 11y agoYes, that was actually proposed by Poettering himself. DragonFly BSD has a similar mechanism with procctl(2).
- thwarted 11y agoYeah, I did research a while ago to find out where that patch came from when there was a lot of noise about how systemd needed to be pid 1.
- digi_owl 11y agoAs a bit of an aside, cgmanager got kinda sidelined thanks to the cgroups kernel maintainer at one point insisting on there being only one cgroup management process. And as systemd did both init and cgroup management, it ended up being favored...