summaryrefslogtreecommitdiff
path: root/statuspage/lib/common.sh
diff options
context:
space:
mode:
Diffstat (limited to 'statuspage/lib/common.sh')
-rwxr-xr-xstatuspage/lib/common.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/statuspage/lib/common.sh b/statuspage/lib/common.sh
index d063e07..dcc26f5 100755
--- a/statuspage/lib/common.sh
+++ b/statuspage/lib/common.sh
@@ -47,3 +47,11 @@ port_check() {
jail_status() {
jls -j "$1" >/dev/null 2>&1 && echo "ok" || echo "down"
}
+
+# proc_running PATTERN
+# Prints "ok" or "down" depending on whether any process's command line
+# matches PATTERN (pgrep -f). For ad-hoc background processes that
+# aren't rc.d-managed, so there's no `service ... status` for them.
+proc_running() {
+ pgrep -f "$1" >/dev/null 2>&1 && echo "ok" || echo "down"
+}