Re: Service with alternative configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If anyone should be faced with a similar issue, i solved it by setting and unsetting a systemd environment variable (e.g. SERVICE_FOO_OPTARGS) referenced from ExecStart of the service' unit file and then restarting the service. On DBus there are SetEnvironment and UnsetEnvironment methods, or set-environment and unset-environment commands when using systemctl.

Am Do., 7. März 2019 um 14:03 Uhr schrieb Marv Lelgemann <144dbspl@xxxxxxxxx>:
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
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux