Thanks. Should I replace list-enabled and list-disabled with list, doing this:
if [ "$1" = "list" ]; then
for F in /etc/init.d/* ; do
printf "%-30s\t%10s\t%10s\n" "$F" \
$( $($F enabled) && echo "enabled" || echo "disabled" ) \
$( [ "$(ubus call service list "{ 'verbose': true,
'name': '$(basename $F)' }" \
| jsonfilter -q -e "@.$(basename
$F).instances[*].running")" = "true" ] \
&& echo "running" || echo "stopped" )
done;
fi
?
On Thu, Jun 4, 2020 at 6:02 AM Paul Fertser <[email protected]> wrote:
>
> On Thu, Jun 04, 2020 at 02:56:31AM -0700, Stan Grishin wrote:
> > If there's a one/two liner to figure out if a service is running or
> > not,
>
> ubus call service list '{ "verbose": true, "name": "openvpn" }' | \
> jsonfilter -e '@.openvpn.instances["foo"].running
>
> --
> Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
> mailto:[email protected]
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel