Re: [systemd-devel] Access session bus from service application

2018-08-14 Thread deepan muthusamy
Thank you for the clarification.

On Tue, 14 Aug 2018, 3:22 pm Mantas Mikulėnas,  wrote:

> On Tue, Aug 14, 2018 at 11:49 AM deepan muthusamy 
> wrote:
>
>> I have to start all my applications through systemd. But when I am trying
>> to start even A2, A3, A4 also i am facing same problem.
>>
>
> Sounds like you *don't have* a session bus at all, then?
>
> If 100% of your applications start via systemd .services, then you should
> start the bus via systemd .service as well. (For example, create a
> "dbus-session.service"; make sure to specify a static --address. Ideally
> create a matching .socket unit as well.)
>
> Once the session bus is running, your other programs/services need to be
> told about its address (via environment variables).
>
> --
> Mantas Mikulėnas
>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Access session bus from service application

2018-08-14 Thread Mantas Mikulėnas
On Tue, Aug 14, 2018 at 11:49 AM deepan muthusamy 
wrote:

> I have to start all my applications through systemd. But when I am trying
> to start even A2, A3, A4 also i am facing same problem.
>

Sounds like you *don't have* a session bus at all, then?

If 100% of your applications start via systemd .services, then you should
start the bus via systemd .service as well. (For example, create a
"dbus-session.service"; make sure to specify a static --address. Ideally
create a matching .socket unit as well.)

Once the session bus is running, your other programs/services need to be
told about its address (via environment variables).

-- 
Mantas Mikulėnas
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Access session bus from service application

2018-08-14 Thread Mantas Mikulėnas
On Tue, Aug 14, 2018 at 9:46 AM deepan muthusamy 
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
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Access session bus from service application

2018-08-14 Thread deepan muthusamy
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?




On Tue, 14 Aug 2018, 10:15 am Mantas Mikulėnas,  wrote:

> On Tue, Aug 14, 2018 at 7:21 AM deepan muthusamy 
> wrote:
>
>> I have an application which has to communicate with systemd to monitor
>> other process and it has to communicate with other session applications ,
>> so my application is designed to communicate to both session dbus and
>> system dbus. And also my application has to be started as service by
>> systemd. How to do this?
>>
>
> If it's a session application, why does it have to be started by systemd?
> That isn't a requirement for accessing the system bus; any application can
> access the system bus.
>
> --
> Mantas Mikulėnas
>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Access session bus from service application

2018-08-13 Thread Mantas Mikulėnas
On Tue, Aug 14, 2018 at 7:21 AM deepan muthusamy 
wrote:

> I have an application which has to communicate with systemd to monitor
> other process and it has to communicate with other session applications ,
> so my application is designed to communicate to both session dbus and
> system dbus. And also my application has to be started as service by
> systemd. How to do this?
>

If it's a session application, why does it have to be started by systemd?
That isn't a requirement for accessing the system bus; any application can
access the system bus.

-- 
Mantas Mikulėnas
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Access session bus from service application

2018-08-13 Thread deepan muthusamy
I have an application which has to communicate with systemd to monitor
other process and it has to communicate with other session applications ,
so my application is designed to communicate to both session dbus and
system dbus. And also my application has to be started as service by
systemd. How to do this?

Iam facing process termination when try trying to access session dbus, only
when iam starting as boot process. If I run manually or run with init.d, my
application is running sucessfully. Any way to solve this issue?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel