[systemd-devel] Access session bus from service application

Mantas Mikulėnas grawity at gmail.com
Tue Aug 14 06:55:53 UTC 2018


On Tue, Aug 14, 2018 at 9:46 AM deepan muthusamy <deepan.m2903 at gmail.com>
wrote:

> I am not that much clear about booting process, but I will explain what I
> want to do, please help me with this.
>
> My system has no login user except root. I logged in as root.
>
> I have an application called A1 which has to communicate to systemd to
> monitor other process such as A2 ,A3 and A4.
>
> Process A2, A3 ,A4 are communicating to A1 through session dbus. This is
> the implementation.
>
> But all process has to be started at boot time as services under user
> defined target levels which I know how to do.
>
> This is my requirement.
>
> My problem is iam not able to start  as service since when my application
> trying to get session dbus connection, it  is failing.
>
> I come to know that it is possible from your previous replies. But I don't
> know how to do that. Can you please help me this?
>

First find out what is starting the session bus and how. You're saying that
existing processes (A2, A3, A4) are already started via systemd *and*
already communicate on the session bus. So take a look at them and figure
out how *they* find the session bus. Then just use the same method.

For example, if your system is configured such that the session bus is
started through its own service and has a fixed address (i.e. the same on
every boot), then you can specify that address through the
$DBUS_SESSION_BUS_ADDRESS environment variable, or even pass it directly to
the DBus library you're using.

-- 
Mantas Mikulėnas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180814/20a76985/attachment-0001.html>


More information about the systemd-devel mailing list