aboutsummaryrefslogtreecommitdiffstats
path: root/package/system/procd/files
diff options
context:
space:
mode:
Diffstat (limited to 'package/system/procd/files')
-rw-r--r--package/system/procd/files/procd.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh
index b49b2b9d01..8d6d406012 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -30,6 +30,9 @@
# 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)
#
@@ -402,6 +405,18 @@ _procd_add_instance() {
_procd_close_instance
}
+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"