[systemd-devel] Service with alternative configuration

Marv Lelgemann 144dbspl at gmail.com
Mon Mar 18 21:01:27 UTC 2019


Am Montag, 11. März 2019 schrieb Lennart Poettering <lennart at poettering.net
>:
> On Do, 07.03.19 14:03, Marv Lelgemann (144dbspl at gmail.com) wrote:
>
>> I have a systemd service unit of type "dbus". I would like to have the
>> option to restart (or stop and start) the service with additional command
>> line arguments in "ExecStart".
>
> Do something like this:
>
>     mkdir -p /etc/systemd/system/foo.service.d/
>     cat > /etc/systemd/system/foo.service.d/override.conf <<EOF
>     [Service]
>     ExecStart=
>     ExecStart=/path/to/my/command --with=a --new-commandline
>     EOF
>     systemctl daemon-reload
>     systemctl restart foo.service
>
> i.e. add a drop-in that first resets ExecStart= to the empty list, and
> the writes the new cmdline to use into it.

Yes, that's a persistent overlay. I was looking for a runtime
reconfiguration, something to restart a service on an embedded system in
debug mode or similar use cases. A template unit with instances
service at default and service at debug would have been OK, but left me with a
dbus name conflict. SetEnvironment worked for me.

>
> Lennart
>
> --
> Lennart Poettering, Red Hat
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20190318/6515f920/attachment-0001.html>


More information about the systemd-devel mailing list