procd: allow usage of * as procd_running() instance parameter
service_running() implementation in /etc/rc.common use it. It is preferable to use wildcard than assuming the instance name is the default one. jsonfilter returns all matches when wildcards are used, hence the -l 1 argument used to limit output to only one value. Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
This commit is contained in:
parent
91aabae895
commit
ddf6ec29b4
@ -8,7 +8,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=procd
|
PKG_NAME:=procd
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=3
|
||||||
|
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git
|
PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git
|
||||||
|
@ -407,12 +407,12 @@ _procd_add_instance() {
|
|||||||
|
|
||||||
procd_running() {
|
procd_running() {
|
||||||
local service="$1"
|
local service="$1"
|
||||||
local instance="${2:-instance1}"
|
local instance="${2:-*}"
|
||||||
local running
|
[ "$instance" = "*" ] || instance="'$instance'"
|
||||||
|
|
||||||
json_init
|
json_init
|
||||||
json_add_string name "$service"
|
json_add_string name "$service"
|
||||||
running=$(_procd_ubus_call list | jsonfilter -e "@['$service'].instances['$instance'].running")
|
local running=$(_procd_ubus_call list | jsonfilter -l 1 -e "@['$service'].instances[$instance].running")
|
||||||
|
|
||||||
[ "$running" = "true" ]
|
[ "$running" = "true" ]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user