This should be helpful for implementing service_running() in procd init
scripts.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
include $(TOPDIR)/rules.mk
PKG_NAME:=procd
include $(TOPDIR)/rules.mk
PKG_NAME:=procd
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git
# procd_close_instance():
# Complete the instance being prepared
#
# procd_close_instance():
# Complete the instance being prepared
#
+# procd_running(service, [instance]):
+# Checks if service/instance is currently running
+#
# procd_kill(service, [instance]):
# Kill a service instance (or all instances)
#
# procd_kill(service, [instance]):
# Kill a service instance (or all instances)
#
+procd_running() {
+ local service="$1"
+ local instance="${2:-instance1}"
+ local running
+
+ json_init
+ json_add_string name "$service"
+ running=$(_procd_ubus_call list | jsonfilter -e "@.$service.instances.${instance}.running")
+
+ [ "$running" = "true" ]
+}
+
_procd_kill() {
local service="$1"
local instance="$2"
_procd_kill() {
local service="$1"
local instance="$2"