Re: [systemd-devel] ActiveState property with value "inactive"is not being sent out when service is killed by signal

2016-07-27 Thread Pradeepa Kumar
Thanks Adrien.
yes it is same issue.
Could you please let me know how did you resolve this ?
I was browsing through sytemd code and my theory is that by the time
properties changed signal is being prepared to be sent, service has already
gone through mutiple state changes or the unit is unloaded and hence no
property changeg signal is sent out.
As workaround , I am planning to watch on SubState instead of ActiveState
in PropertiesChanged signal and also have ExecStopPost in service file.
I have noticied that, when a service becomes inactive  I always get
SubState=stop-post (when i have ExecStopPost ).

Can anyone please comment if this is correct work-around ?

Thanks


On Wed, Jul 27, 2016 at 2:26 PM, Adrien Besnard <adrien.besn...@gmail.com>
wrote:

> I may be wrong, but it sounds like the issue I encoutered here:
> https://github.com/systemd/systemd/issues/3390. I also wanted to build a
> service monitoring tool :)
>
> Cheers,
> --
> Adrien BESNARD
>
> 2016-07-26 11:24 GMT+02:00 Pradeepa Kumar <cdprade...@gmail.com>:
>
>> Hi
>> ActiveState property with value "inactive"is not being sent out when
>> service is killed by signal
>> I am using 219 version.
>> I logged issue https://github.com/systemd/systemd/issues/3807
>> Thanks
>>
>>
>>
>> ___
>> systemd-devel mailing list
>> systemd-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>>
>>
>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] ActiveState property with value "inactive"is not being sent out when service is killed by signal

2016-07-26 Thread Pradeepa Kumar
Hi
ActiveState property with value "inactive"is not being sent out when
service is killed by signal
I am using 219 version.
I logged issue https://github.com/systemd/systemd/issues/3807
Thanks
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] How to reset startlimitburst and startlimitinterval

2016-06-18 Thread Pradeepa Kumar
Hi
Could you please let me know to reset startlimitburst and
startlimitinterval of service.
I am writing unit tests and each test should start fresh and run test on
service .so values of startlimitburst   and startlimitinterval of  previous
test should be reset before running each test .
Thanks for help
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] service stop taking too long

2016-05-20 Thread Pradeepa Kumar
I debugged this further .
And this turned out to be issue with our script in ExecStop.
Thanks for comments
On May 20, 2016 8:16 PM, "Lennart Poettering" <lenn...@poettering.net>
wrote:

> On Wed, 18.05.16 20:38, Pradeepa Kumar (cdprade...@gmail.com) wrote:
>
> > sorry for not being clear earlier.
> >  may be i am not explaining properly.
> >
> > In XYZ.service:
> > ExecStop: myscript1
> >
> > $cat myscript1
> > echo "inside myscript1"
> >
> >
> > and
> >
> > The sequence in jounrnalctl logs are:
> >
> >  May 18 01:18:06 machine1 systemd[1]: Stopping "XYZ service"...
> > ...
> >  May 18 01:18:46 machine1  myscript1[3941]: inside myscript1
> >
> > As you can see, the beginning of execution of myscript1 took 40 sec.
>
> So you are saying that systemd reports that it is starting your script
> 40 seconds before your script is actually started?
>
> If so, this would suggest that something hangs in the time systemd forks
> off your stop script, but before exec() is actually called for
> it. This could be an NSS look-up done due to User= or Group=, or a PAM
> intraction done via PAM= or so.
>
> How precisely does your full service file look like?
>
> Lennart
>
> --
> Lennart Poettering, Red Hat
>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] service stop taking too long

2016-05-18 Thread Pradeepa Kumar
sorry for not being clear earlier.
 may be i am not explaining properly.

In XYZ.service:
ExecStop: myscript1

$cat myscript1
echo "inside myscript1"


and

The sequence in jounrnalctl logs are:

 May 18 01:18:06 machine1 systemd[1]: Stopping "XYZ service"...
...
 May 18 01:18:46 machine1  myscript1[3941]: inside myscript1

As you can see, the beginning of execution of myscript1 took 40 sec.




On Wed, May 18, 2016 at 8:23 PM, Reindl Harald <h.rei...@thelounge.net>
wrote:

>
>
> Am 18.05.2016 um 16:51 schrieb Pradeepa Kumar:
>
>> My understanding is ExecStop will be called before sending SIGTERM to
>> service.
>> if it is true then systemd took 42 sec to initiate stop sequence
>> (calling script in ExecStop) and send SIGTERM to service.
>> please correct me if I am wrong
>>
>
> you don't get it
> your "ExecStop" took 42 sec
>
> On Wed, May 18, 2016 at 7:58 PM, Reindl Harald <h.rei...@thelounge.net
>> <mailto:h.rei...@thelounge.net>> wrote:
>>
>> Am 18.05.2016 um 16:23 schrieb Pradeepa Kumar:
>>
>> I have a script in ExecStop in service file.
>> In journalctl, The time difference between "Stopping XYZ service
>> " and
>> logs from my script in ExecStop is 42 sec.
>> Does that mean systemd itself took long time to start stopping of
>> service?
>>
>>
>> no, it means systemd is only the messenger and your script took 42
>> seconds to finish
>>
>> On Wed, May 18, 2016 at 5:36 PM, Lennart Poettering
>> <lenn...@poettering.net <mailto:lenn...@poettering.net>
>> <mailto:lenn...@poettering.net <mailto:lenn...@poettering.net>>>
>> wrote:
>>
>> On Wed, 18.05.16 16:00, Pradeepa Kumar (cdprade...@gmail.com
>> <mailto:cdprade...@gmail.com>
>> <mailto:cdprade...@gmail.com <mailto:cdprade...@gmail.com>>)
>> wrote:
>>
>> > Hi experts,
>> > I am using systemd v219.
>> > I need help with a systemd issue that I am seeing.
>> > I see that some times stopping of service is taking long
>> time (42 sec).
>> > i checked this in journal logs also.
>> >  is this is known issue ?
>> > how do i debug this ?
>> >  and any solutions ?
>>
>> Well, that depends on the specific service. If a specific
>> service
>> takes 42s to shut down, then try figuring out what it does.
>> If there's
>> nothing in the journal, then maybe the service maintains its
>> own logs?
>> If it does not, see if you can turn on debug logging for it.
>>
>> Either way, that's really a question to ask the maintainers
>> of that
>> service, not to systemd upstream.
>>
>
>
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] service stop taking too long

2016-05-18 Thread Pradeepa Kumar
My understanding is ExecStop will be called before sending SIGTERM to
service.
if it is true then systemd took 42 sec to initiate stop sequence (calling
script in ExecStop) and send SIGTERM to service.
please correct me if I am wrong

On Wed, May 18, 2016 at 7:58 PM, Reindl Harald <h.rei...@thelounge.net>
wrote:

>
>
> Am 18.05.2016 um 16:23 schrieb Pradeepa Kumar:
>
>> I have a script in ExecStop in service file.
>> In journalctl, The time difference between "Stopping XYZ service " and
>> logs from my script in ExecStop is 42 sec.
>> Does that mean systemd itself took long time to start stopping of
>> service?
>>
>
> no, it means systemd is only the messenger and your script took 42 seconds
> to finish
>
> On Wed, May 18, 2016 at 5:36 PM, Lennart Poettering
>> <lenn...@poettering.net <mailto:lenn...@poettering.net>> wrote:
>>
>> On Wed, 18.05.16 16:00, Pradeepa Kumar (cdprade...@gmail.com
>> <mailto:cdprade...@gmail.com>) wrote:
>>
>> > Hi experts,
>> > I am using systemd v219.
>> > I need help with a systemd issue that I am seeing.
>> > I see that some times stopping of service is taking long time (42
>> sec).
>> > i checked this in journal logs also.
>> >  is this is known issue ?
>> > how do i debug this ?
>> >  and any solutions ?
>>
>> Well, that depends on the specific service. If a specific service
>> takes 42s to shut down, then try figuring out what it does. If there's
>> nothing in the journal, then maybe the service maintains its own logs?
>> If it does not, see if you can turn on debug logging for it.
>>
>> Either way, that's really a question to ask the maintainers of that
>> service, not to systemd upstream.
>>
>
>
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] service stop taking too long

2016-05-18 Thread Pradeepa Kumar
Thanks.
I have a script in ExecStop in service file.
In journalctl, The time difference between "Stopping XYZ service " and logs
from my script in ExecStop is 42 sec.
Does that mean systemd itself took long time to start stopping of service .
?

On Wed, May 18, 2016 at 5:36 PM, Lennart Poettering <lenn...@poettering.net>
wrote:

> On Wed, 18.05.16 16:00, Pradeepa Kumar (cdprade...@gmail.com) wrote:
>
> > Hi experts,
> > I am using systemd v219.
> > I need help with a systemd issue that I am seeing.
> > I see that some times stopping of service is taking long time (42 sec).
> > i checked this in journal logs also.
> >  is this is known issue ?
> > how do i debug this ?
> >  and any solutions ?
>
> Well, that depends on the specific service. If a specific service
> takes 42s to shut down, then try figuring out what it does. If there's
> nothing in the journal, then maybe the service maintains its own logs?
> If it does not, see if you can turn on debug logging for it.
>
> Either way, that's really a question to ask the maintainers of that
> service, not to systemd upstream.
>
> Lennart
>
> --
> Lennart Poettering, Red Hat
>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] service stop taking too long

2016-05-18 Thread Pradeepa Kumar
Hi experts,
I am using systemd v219.
I need help with a systemd issue that I am seeing.
I see that some times stopping of service is taking long time (42 sec).
i checked this in journal logs also.
 is this is known issue ?
how do i debug this ?
 and any solutions ?

Thanks for help.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to get notified on service state change

2015-10-11 Thread Pradeepa Kumar
2nd try..


On Fri, Oct 9, 2015 at 6:52 AM, Pradeepa Kumar <cdprade...@gmail.com> wrote:

> Hi systemd-experts,
>
> I am writing a daemon which starts, stops and monitor services and I am
> using dbus to interface with systemd. I send messages on dbus to start or
> stop the service and this is working well. I want to achieve the following:
>
>
>
> 1) Monitor service exit using the systemd dbus interface.
>
> 2) Monitor when the service has entered a failed state
>
>
>
> I am trying to understand what is the right mechanism to implement this
> using the systemd dbus interface, I have tried a few things clearly I don’t
> understand how this works, any help greatly appreciated.
>
>
>
> I am looking for way to know when service stopped or failed so that i can
> take some action in my monitoring app.
>
> I am listening to PropertiesChanged signal and query ActiveState property
> to get new value. This does not work always.
> Some times, unit is unloaded before I query the ActiveState.
> Do we get new values of property along with PropertiesChanged signal in
> new version of systemd?
> if yes in which version this feature was added ?
> What is the best way to achieve my requirement ?
>
> Appreciate your help on above queries
>
>
>
> Thanks
>
> Prashant
>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] changed property value in signal

2015-10-08 Thread Pradeepa Kumar
Thanks for reply.

I am writing a monitoring application to start, stop and monitor service
state.

I am looking for way to know when service stoppped or failed so that i can
take some action in my monitoring app.

I am listening to PropertiesChanged signal and query ActiveState. This does
not work always.
Some times, unit is unloaded before I query the ActiveState. What is the
solution for this

Do we get new values of property along with PropertiesChanged signal in new
version of systemd?
if yes in which version this feature was added ?

What is the solution to achieve my requirement ?



On Fri, Jul 3, 2015 at 3:35 PM, Lennart Poettering <lenn...@poettering.net>
wrote:

> On Fri, 03.07.15 15:12, Pradeepa Kumar (cdprade...@gmail.com) wrote:
>
> > On Fri, Jul 3, 2015 at 2:12 PM, Lennart Poettering <
> lenn...@poettering.net>
> > wrote:
> >
> > > On Thu, 02.07.15 10:18, Pradeepa Kumar (cdprade...@gmail.com) wrote:
> > >
> > > > hi
> > > > I am new to systemd.
> > > > I am using systemd 208, libdbus-1-3_1.4.18-1ubuntu1.4_i386.deb
> > > > I am to monitor unit stop/failure in my application .
> > > > So I am subscribing to propertiesChanged signal and paring SubState.
> > > > The propertieschanged message contains a dictionary and invalidated
> list
> > > > of properties.
> > > > But the dictionary is empty(which is supposed to contain new value of
> > > > changed properties), so i am left with querying new values of the
> changed
> > > > property from list of invalidated properties list.
> > > >
> > > > - please let me know how do i get new values in the signal msg
> > > >   itself
> > >
> > > you don't. We just invalidate the props, you have to query them
> > > aftwards yourself, to determine the n value.
> >
> >  Prad>>  But in online, i see some example of dbus-monitor command where
> > output has a dictionary- which contains properties and new values.
> > I want same output. how do i get that??
>
> You don't... It's up to the service to decide which properties it
> just invalidates and which ones it sends along.
>
> > > We take the liberty to invalidate some props and send the full value
> > > of others along. it's not considered api really which prop gets which
> > > behaviour...
> >
> > Prad>> I did not understand this comment
> > Can you please explain
>
> It's up to the service (in this case systemd) to choose which props it
> sends PropertiesChanged signals for, and if it decides to do so,
> for which it sends invalidation and for which it sends the full value
> along.
>
> Lennart
>
> --
> Lennart Poettering, Red Hat
>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] How to get notified on service state change

2015-10-08 Thread Pradeepa Kumar
Hi systemd-experts,

I am writing a daemon which starts, stops and monitor services and I am
using dbus to interface with systemd. I send messages on dbus to start or
stop the service and this is working well. I want to achieve the following:



1) Monitor service exit using the systemd dbus interface.

2) Monitor when the service has entered a failed state



I am trying to understand what is the right mechanism to implement this
using the systemd dbus interface, I have tried a few things clearly I don’t
understand how this works, any help greatly appreciated.



I am looking for way to know when service stopped or failed so that i can
take some action in my monitoring app.

I am listening to PropertiesChanged signal and query ActiveState property
to get new value. This does not work always.
Some times, unit is unloaded before I query the ActiveState.
Do we get new values of property along with PropertiesChanged signal in new
version of systemd?
if yes in which version this feature was added ?
What is the best way to achieve my requirement ?

Appreciate your help on above queries



Thanks

Prashant
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] c/c++ lib for dbus

2015-07-20 Thread Pradeepa Kumar
Hi
I need to use functions to call method, get property value etc from dbus.
also few utility functions  like unit_name_from_dbus_path() from systemd.
Can i use systemd as lib ? If yes how , where can I see examples?
is there any lib for that in c /c++?
Thanks
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How do I monitor for service exit , service failure and service start using DBus ?

2015-07-12 Thread Pradeepa Kumar
Hi all,
2nd try.
I did not get any response for my queries.
I am blocked on my work due to these queries.
Any comments are highly welcome and  appreciated
Thanks ,
Prashant


On Fri, Jul 10, 2015 at 11:36 AM, Pradeepa Kumar cdprade...@gmail.com
wrote:


 Hello systemd-experts,

 I am new to systemd and dbus.

 I am writing a daemon which starts, stops and monitor services and I am
 using dbus to interface with systemd. I send messages on dbus to start or
 stop the service and this is working well. I want to achieve the following:


 a) Monitor service exit using the systemd dbus interface.

 b) Monitor when the service has entered a failed state (the app has been
 restarted n times in m seconds).



 I am trying to understand what is the right mechanism to implement this
 using the systemd dbus interface, I have tried a few things clearly I don’t
 understand how this works, any help greatly appreciated.



 In my first attempt I subscribed to JobRemoved signal from systemd as
 explained here (http://www.freedesktop.org/wiki/Software/systemd/dbus/).
 I was able to figure out when the service failed by looking at the result
 string.



 ———

 JobNew() and JobRemoved() are sent out each time a new job is queued or
 dequeued. Both signals take the numeric job ID, the bus path and the
 primary unit name for this job as argument. JobRemoved() also includes a
 result string, being one of done, canceled, timeout, failed, dependency,
 skipped. done indicates successful execution of a job. canceled indicates
 that a job has been canceled (via CancelJob() above) before it finished
 execution (this doesn't necessarily mean though that the job operation is
 actually cancelled too, see above). timeout indicates that the job timeout
 was reached. failed indicates that the job failed. dependency indicates
 that a job this job has been depending on failed and the job hence has been
 removed too. skipped indicates that a job was skipped because it didn't
 apply to the units current state.

 ——



 I soon realized that I was getting spurious JobRemoved signals.



 I am now trying to achieve (1) and (2) by subscribing to PropertiesChanged
 signal and I have a few questions here:



 1) When I get the PropertiesChanged, I query the SubState property to get
 the running/stop state of the service. Is querying the SubState property
 the right way to get the service status? If SubState value is “running”
 then I infer that app is running and its any other value, I infer the app
 is down. I am not relying on ActiveState because I see that for some
 signal, ActiveState is “active” but SubState as “exited”.

  Is this approach correct?



 2) When a service exits, I get multiple PropertiesChanged signal.



kill -9  myservice will transition myservice to  “stop”,
 “auto-restart” and then “running” SubState

systemctl restart myservice will transition myservice to   “stop”,
 “stop-sigterm” and then  “running” SubState.

systemctl stop myservice will transition myservice to   “stop” and then
  “stop-sigterm” SubState.



 What does “stop” and “stop-term” mean here and why are there 2 signals to
 indicate stop? Is “stop” a good indicator that the service has stopped?

 In my client, I can cache the services and their states.


 3)How do I get to know when an application has failed (failed here means
 when systemd will not restart application again after n app exits in m
 seconds).

 When I was using JobRemoved, I used the value of “failed” in “result”
 parameter in JobRemoved signal, was this the correct indicator to determine
 service failure?



 4) How do I get to know when an service has started? When I issue
 “systemctl start myservice”, I do not getany PropertiesChanged signal, I
 receive JobNew, JobRemoved and then UnitNew signals.



 I thought of subscribing to UnitNew signal. But I also get these multiple
 (i.e 2) UnitNew and UnitRemoved signal when I do ‘systemctl stop
  myservice’ too. Why do I get UnitNew when a service is being stopped?



 From my research I understand that requesting the properties of an
 unloaded unit will cause systemd to send a pair of UnitNew/UnitRemoved
 signals and this may lead to infinite loop.

 How do I fix this?



 Am I solving the requirement (a) and (b) correctly or should I be using a
 different mechanism to achieve (a) and (b).



 Appreciate your help on above queries



 Thanks

 Prashant



___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] How do I monitor for service exit , service failure and service start using DBus ?

2015-07-10 Thread Pradeepa Kumar
Hello systemd-experts,

I am new to systemd and dbus.

I am writing a daemon which starts, stops and monitor services and I am
using dbus to interface with systemd. I send messages on dbus to start or
stop the service and this is working well. I want to achieve the following:


a) Monitor service exit using the systemd dbus interface.

b) Monitor when the service has entered a failed state (the app has been
restarted n times in m seconds).



I am trying to understand what is the right mechanism to implement this
using the systemd dbus interface, I have tried a few things clearly I don’t
understand how this works, any help greatly appreciated.



In my first attempt I subscribed to JobRemoved signal from systemd as
explained here (http://www.freedesktop.org/wiki/Software/systemd/dbus/). I
was able to figure out when the service failed by looking at the result
string.



———

JobNew() and JobRemoved() are sent out each time a new job is queued or
dequeued. Both signals take the numeric job ID, the bus path and the
primary unit name for this job as argument. JobRemoved() also includes a
result string, being one of done, canceled, timeout, failed, dependency,
skipped. done indicates successful execution of a job. canceled indicates
that a job has been canceled (via CancelJob() above) before it finished
execution (this doesn't necessarily mean though that the job operation is
actually cancelled too, see above). timeout indicates that the job timeout
was reached. failed indicates that the job failed. dependency indicates
that a job this job has been depending on failed and the job hence has been
removed too. skipped indicates that a job was skipped because it didn't
apply to the units current state.

——



I soon realized that I was getting spurious JobRemoved signals.



I am now trying to achieve (1) and (2) by subscribing to PropertiesChanged
signal and I have a few questions here:



1) When I get the PropertiesChanged, I query the SubState property to get
the running/stop state of the service. Is querying the SubState property
the right way to get the service status? If SubState value is “running”
then I infer that app is running and its any other value, I infer the app
is down. I am not relying on ActiveState because I see that for some
signal, ActiveState is “active” but SubState as “exited”.

 Is this approach correct?



2) When a service exits, I get multiple PropertiesChanged signal.



   kill -9  myservice will transition myservice to  “stop”,
“auto-restart” and then “running” SubState

   systemctl restart myservice will transition myservice to   “stop”,
“stop-sigterm” and then  “running” SubState.

   systemctl stop myservice will transition myservice to   “stop” and then
 “stop-sigterm” SubState.



What does “stop” and “stop-term” mean here and why are there 2 signals to
indicate stop? Is “stop” a good indicator that the service has stopped?

In my client, I can cache the services and their states.


3)How do I get to know when an application has failed (failed here means
when systemd will not restart application again after n app exits in m
seconds).

When I was using JobRemoved, I used the value of “failed” in “result”
parameter in JobRemoved signal, was this the correct indicator to determine
service failure?



4) How do I get to know when an service has started? When I issue
“systemctl start myservice”, I do not getany PropertiesChanged signal, I
receive JobNew, JobRemoved and then UnitNew signals.



I thought of subscribing to UnitNew signal. But I also get these multiple
(i.e 2) UnitNew and UnitRemoved signal when I do ‘systemctl stop
 myservice’ too. Why do I get UnitNew when a service is being stopped?



From my research I understand that requesting the properties of an unloaded
unit will cause systemd to send a pair of UnitNew/UnitRemoved signals and
this may lead to infinite loop.

How do I fix this?



Am I solving the requirement (a) and (b) correctly or should I be using a
different mechanism to achieve (a) and (b).



Appreciate your help on above queries



Thanks

Prashant
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] from dbus , how do i find if app went down

2015-07-08 Thread Pradeepa Kumar
I am subscribing to PropertiesChanged signal and caching service and its
 substate in client side.
But i noticed that when service is started , i dont get PropertiesChanged
signal.
how can i update my local client side cache in this case ?
my goal is to let my upper layer know when app goes down (running to other
substate value)


On Mon, Jul 6, 2015 at 10:03 AM, Pradeepa Kumar cdprade...@gmail.com
wrote:

 Caching the unit's statet is one solution.
 But is there any alternative ?
 This seems such a basic use case , surprising why there is no easier API
 for this ?
 On research, I see that some people use JobRemoved signal and on getting
 that signal and if it 'done' they check the ActiveState to figure out if
 unit went down.
 Is this correct way?
 What is JobRemoved means?
 I am looking for simple and easier way to get notified about unit down.
 Thanks for your reply !



 On Fri, Jul 3, 2015 at 4:53 PM, Lennart Poettering lenn...@poettering.net
  wrote:

 On Fri, 03.07.15 16:46, Pradeepa Kumar (cdprade...@gmail.com) wrote:

  When you say 'Check the state instead '
  Did you mean ActiveState ?

 Yes!

 Sorry for the confusion!

 Lennart

 --
 Lennart Poettering, Red Hat



___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] from dbus , how do i find if app went down

2015-07-03 Thread Pradeepa Kumar
I am writing lib which will monitor apps and notify/callback higher level
 if apps went down.
How can I achieve this?
I tried doing this using propertieschanged signal and reading substate
property and that msg does not have old value and new value in the msg.
I noticed that when app go down i get two signals and hence two substates -
stop and stop-term.
So it is difficult to call registered callbacks only when substate changes
from running-stop.
Do i need to maintain current state of app in my lib?
is there any other easier way for this ??
Thanks
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] changed property value in signal

2015-07-03 Thread Pradeepa Kumar
please see my response inline

On Fri, Jul 3, 2015 at 2:12 PM, Lennart Poettering lenn...@poettering.net
wrote:

 On Thu, 02.07.15 10:18, Pradeepa Kumar (cdprade...@gmail.com) wrote:

  hi
  I am new to systemd.
  I am using systemd 208, libdbus-1-3_1.4.18-1ubuntu1.4_i386.deb
  I am to monitor unit stop/failure in my application .
  So I am subscribing to propertiesChanged signal and paring SubState.
  The propertieschanged message contains a dictionary and invalidated  list
  of properties.
  But the dictionary is empty(which is supposed to contain new value of
  changed properties), so i am left with querying new values of the changed
  property from list of invalidated properties list.
 
  - please let me know how do i get new values in the signal msg
itself

 you don't. We just invalidate the props, you have to query them
 aftwards yourself, to determine the new value.

 Prad  But in online, i see some example of dbus-monitor command where
output has a dictionary- which contains properties and new values.
I want same output. how do i get that??


  - is this issue fixed.? if yes in which version? which version i need to
  upgrade

 We take the liberty to invalidate some props and send the full value
 of others along. it's not considered api really which prop gets which
 behaviour...


Prad I did not understand this comment
Can you please explain


  - where do i see commit logs/ version history

 Just check out the systemd git repository.

 Lennart

 --
 Lennart Poettering, Red Hat

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] from dbus , how do i find if app went down

2015-07-03 Thread Pradeepa Kumar
When you say 'Check the state instead '
Did you mean ActiveState ?
On Jul 3, 2015 3:39 PM, Lennart Poettering lenn...@poettering.net wrote:

 On Fri, 03.07.15 15:29, Pradeepa Kumar (cdprade...@gmail.com) wrote:

  I am writing lib which will monitor apps and notify/callback higher level
   if apps went down.
  How can I achieve this?
  I tried doing this using propertieschanged signal and reading
   substate

 We reserve the liberty to introduce new substates, and hence you
 shouldn't check Substate anyway if you want to stay compatible with
 future versions of systemd. Check the State instead, which is more
 abstract and is considered API.

  property and that msg does not have old value and new value in the msg.
  I noticed that when app go down i get two signals and hence two
 substates -
  stop and stop-term.
  So it is difficult to call registered callbacks only when substate
 changes
  from running-stop.

  Do i need to maintain current state of app in my lib?

 If you want to track these state changes, you'd have to cache the
 states client-side.

  is there any other easier way for this ??

 I fear not, sorry.

 Lennart

 --
 Lennart Poettering, Red Hat

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] changed property value in signal

2015-07-02 Thread Pradeepa Kumar
2nd try
On Jul 2, 2015 10:18 AM, Pradeepa Kumar cdprade...@gmail.com wrote:

 hi
 I am new to systemd.
 I am using systemd 208, libdbus-1-3_1.4.18-1ubuntu1.4_i386.deb
 I am to monitor unit stop/failure in my application .
 So I am subscribing to propertiesChanged signal and paring SubState.
 The propertieschanged message contains a dictionary and invalidated  list
 of properties.
 But the dictionary is empty(which is supposed to contain new value of
 changed properties), so i am left with querying new values of the changed
 property from list of invalidated properties list.

 - please let me know how do i get new values in the signal msg itself
 - is this issue fixed.? if yes in which version? which version i need to
 upgrade
 - where do i see commit logs/ version history

 Thanks
 Prad

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] changed property value in signal

2015-07-01 Thread Pradeepa Kumar
hi
I am new to systemd.
I am using systemd 208, libdbus-1-3_1.4.18-1ubuntu1.4_i386.deb
I am to monitor unit stop/failure in my application .
So I am subscribing to propertiesChanged signal and paring SubState.
The propertieschanged message contains a dictionary and invalidated  list
of properties.
But the dictionary is empty(which is supposed to contain new value of
changed properties), so i am left with querying new values of the changed
property from list of invalidated properties list.

- please let me know how do i get new values in the signal msg itself
- is this issue fixed.? if yes in which version? which version i need to
upgrade
- where do i see commit logs/ version history

Thanks
Prad
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel