[OpenWrt-Devel] [PATCH] base-files: add list-enabled/disabled to service function in /etc/profile
Stan Grishin
stangri at melmac.net
Thu Jun 4 09:31:36 EDT 2020
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 <fercerpav at gmail.com> 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:fercerpav at gmail.com
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list