[systemd-devel] ExecReload and dynamic arguments (start control process with arguments)

Vadim Nevorotin nevorotin at gmail.com
Mon Mar 4 14:47:42 UTC 2024


Hi!

We're trying to pack our services to systemd units, but we've run into a
number of problems.

One of them - how to support different "reload" modes? We need to start
some control process in the context of service (like ExecReload does), but
this process supports some arguments and we need to pass them in time of
'systemctl reload' call. Previously we have commands like:

/etc/init.d/ourservice reload|soft-reload|hard-reload [--someargs]

All doing different actions, manipulating service main process/workers and
pidfiles, How can I do it with systemd? Did I miss something in the
documentation?

In general - I need to start a control script in the context of some
service (like ExecReload does), which will be able to replace the main
service process correctly (systemd-notify with NotifyAccess=exec should
help, I hope), and with the ability to pass arguments/env/anything to it.
E.g. like:

systemctl reload service -- --arg=1 somearg
ENVVAR=123 systemctl reload service

Or any other way.

ExecReload command is executed in a clean environment and also is not a
child of systemctl process - so I can't use simple tmp files based on PIDs
or similar to pass args because of possible race conditions (as I see - I
can't find from ExecReload= command the actual process which calls
systemctl reload)

King regards,
Vadim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20240304/d67fea4d/attachment.htm>


More information about the systemd-devel mailing list