[systemd-devel] recommended way to detect systemd?

David Herrmann dh.herrmann at googlemail.com
Sat Dec 29 05:34:26 PST 2012


Hi

On Sat, Dec 29, 2012 at 2:23 PM, Andrey Borzenkov <arvidjaar at gmail.com> wrote:
> В Sat, 29 Dec 2012 13:40:59 +0100
> Manuel Reimer <Manuel.Spam at nurfuerspam.de> пишет:
>
>> Hello,
>>
>> I need a reliable way to find out if a system, where my software runs on, uses
>> systemd.
>>
>> My first thought:
>>
>> $ cat /proc/1/comm
>> systemd
>>
>> Is this a reliable way that will also work in the next few releases of systemd,
>> or should I use something different?
>>
>
> Widely used check is
>
> if /bin/mountpoint -q /sys/fs/cgroup/systemd ; then
> ...
> fi

Or directly use sd_booted(). See fdo for more information if you want
to implement it yourself:
http://www.freedesktop.org/software/systemd/man/sd_booted.html

Regards
David


More information about the systemd-devel mailing list