[systemd-devel] Can I provide separate enabling for dbus-activation and "normal" start ?

Andrei Borzenkov arvidjaar at gmail.com
Thu Feb 22 16:43:50 UTC 2024


On 22.02.2024 19:09, Max Gautier wrote:
> Hi,
> 
> Is it possible when writing a dbus-activable service to provide two
> separate and independent ways to enable it ?
> 
> The D-Bus service file would for instance be:
> [D-BUS Service]
> Name=org.freedesktop.Notifications
> Exec=notification-daemon
> SystemdService=dbus-org.freedesktop.Notifications.service
> 
> The systemd service:
> [Unit]
> PartOf=graphical-session.target
> After=graphical-session.target
> 
> [Service]
> Type=dbus
> BusName=org.freedesktop.Notifications
> ExecStart=notification-daemon
> 
> [Install]
> Alias=dbus-org.freedesktop.Notifications.service
> WantedBy=graphical-session.target
> 
> 
> With that systemd service file, `systemctl enable` would cause the
> service to be started by graphical-session.target and by
> dbus-activation; but it is possible to have two separate enable
> commands, one which would enable the dbus activation, one the
> graphical-session start ?
> 

You do not need any commands, just create corresponding links manually.

> I suppose I should have two separate unit files but I'm not completely
> sure how to do that without copying the whole file (i.e, is there some
> Install/Unit relation I can use for that ?)
> 
> Thanks !
> 



More information about the systemd-devel mailing list