[systemd-devel] RFC: removing initctl support

Lennart Poettering lennart at poettering.net
Thu Sep 24 06:01:21 PDT 2015


On Thu, 24.09.15 13:18, Jonathan de Boyne Pollard (j.deboynepollard-newsgroups at ntlworld.com) wrote:

> In an ideal world you would be able to have a routine that detected the running
> system manager, and then did whatever was appropriate to that system manager to
> power off, from sending signals to process #1 through running the System 5
> init/rc clone's "shutdown -h -P now" command to sending requests to upstart's
> Desktop Bus API.  In the real world, all of the problems that make detecting the
> running system manager really difficult to do that are described at
> http://unix.stackexchange.com/a/196252/5132 rear their ugly heads.  (A further
> problem not mentioned there: Joachim Nilsson's finit also responds to "initctl
> version".)

That stackexchange link lists a pile of garbage. We have an official
API to check whether the system is booted with systemd:
sd_booted(). It's documented here:

http://www.freedesktop.org/software/systemd/man/sd_booted.html

And we even document on that man page what precisely it does
internally (which is equivalent to access("/run/systemd/system/",
F_OK) >= 0) and suggest people to reimplement that simple check in the
language of their choice, even in shell... That way, they don't even
have to link against libsystemd.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list