On 2024-02-29 12:56, Ravi Paluri (QUIC) wrote:
Thanks, Paul for the reply.
Can you help us with a sample usage of "ubus subscribe" OR "ubus listen" OR "ubus 
monitor", which helps us to learn, "running" flag change to false from true.



I know not whether such is even possible. Start here: https://git.openwrt.org/project/ubus.git

We are polling the status of "running" flag as below.
ubus call service list '{"name":"test*.init","verbose":"True"}' | grep -i 
\"running\"

Is * even supposed to work?
this shows the unetd instance:

ubus call service list '{"name":"unetd"}'

this does not:

ubus call service list '{"name":"unet*"}'



ubus call service list '{"name":"unetd"}' | jsonfilter -q -e "@['unetd'].instances[*].running"

returns simply: true



This is working when script execution takes some time.
For some scripts that take very less time (for e.g, a single instruction such as "uci set 
.."), we are not able to detect the transition of "running" flag to false from true 
as the flag changes it's value quickly.

How about using the return code of the script?


Thanks,
Ravi
-----Original Message-----
From: openwrt-devel <openwrt-devel-boun...@lists.openwrt.org> On Behalf Of Paul 
D
Sent: Friday, February 23, 2024 7:35 PM
To: openwrt-devel@lists.openwrt.org
Subject: Re: ubus running key status

WARNING: This email originated from outside of Qualcomm. Please be wary of any 
links or attachments, and do not enable macros.

On 2024-02-23 13:43, Ravi Paluri (QUIC) wrote:
Can you let us know, is there a way to get a notification when the "running" key value moves to 
"false" from "true"?
OR is there any ubus API to which we can register a callback, which will then 
be invoked when the execution is complete?

Not certain about callbacks - but there is "ubus monitor" "ubus subscribe" "ubus listen" 
and "ubus wait_for"

They're blocking calls, at least.



_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to