[systemd-devel] Service with alternative configuration

Marv Lelgemann 144dbspl at gmail.com
Thu Mar 7 13:03:54 UTC 2019


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".

I tried using a template unit with "EnvironmentFile" selected by the
instance name. I also tried a template unit with drop-in configuration
files which override the "ExecStart". Both approaches somehow worked but
led to a problem sooner or later when the default instance was enabled in
my default target. The error message is "Two services allocated for the
same bus name" when trying to start the non-default service, even if no
other instance is started. Using "Conflicts" in the unit file also didn't
help.

What I essentially want to achieve is to restart a running service with
another set of command line arguments (non-persistent). I want to do this
preferably over systemd's DBus API from within my application. I tried
using org.freedesktop.systemd1.Manager.SetUnitProperties to update
EnvironmentFile but this didn't work.

Any ideas on how to achieve this?

-Marv
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20190307/6b2bdeeb/attachment.html>


More information about the systemd-devel mailing list