It was <2025-06-30 pon 12:25>, when Stef Bon wrote:

> it's important for a program to detect it has been started by systemd.
> For example it does not have to fork since it has already been forked.
>
> I've written a test script, which calls env, and there are a few
> unique environment variables which are an indication it has been
> started by systemd: SYSTEMD_EXEC_PID and INVOCATION_ID.
>
> Is it a good way to test these environment vars (to detect started by
> systemd) or is there a better way?

It seems reasonable. You may want to read systemd's daemon(7) manual
page[1] to get a bigger picture, how programs should interact with
systemd.

[1] https://www.freedesktop.org/software/systemd/man/latest/daemon.html#
-- 
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics

Attachment: signature.asc
Description: PGP signature

Reply via email to