summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Krüger <mkg20001@gmail.com>2022-04-10 01:58:41 +0200
committerJosef Schlehofer <pepe.schlehofer@gmail.com>2023-07-06 14:31:47 +0200
commitff834a87c0f73f11706ecee2273649a3137c2126 (patch)
treef4c25dc15af3b0ad465a4e6e7a5f762ba648c732
parent1b720129f7928d7a22ac9e7d27a700789dc851b1 (diff)
oonf-olsrd2: add support to check if service is running
Signed-off-by: Maciej Krüger <mkg20001@gmail.com> (cherry picked from commit 618e80a06a6c032d09bc9cfa333fde893ec9f8d1)
-rwxr-xr-xoonf-init-scripts/files/oonf_init.sh17
-rw-r--r--oonf-olsrd2/Makefile2
-rwxr-xr-xoonf-olsrd2/files/olsrd2.init3
3 files changed, 21 insertions, 1 deletions
diff --git a/oonf-init-scripts/files/oonf_init.sh b/oonf-init-scripts/files/oonf_init.sh
index 8ab5b3b..a945c4e 100755
--- a/oonf-init-scripts/files/oonf_init.sh
+++ b/oonf-init-scripts/files/oonf_init.sh
@@ -118,3 +118,20 @@ reload()
oonf_add_devices_to_configuration
oonf_reread_config
}
+
+running()
+{
+ # check if we have a pidfile and then check if that pid still exists.
+ # since we don't use -e this has to be explicitly returned. exit would stop the process.
+ test -e "/tmp/run/olsrd2.pid" && test -e "/proc/$(cat "/tmp/run/olsrd2.pid")" && return 0
+ return 1
+}
+
+status()
+{
+ if running; then
+ echo "running"
+ else
+ echo "stopped"
+ fi
+}
diff --git a/oonf-olsrd2/Makefile b/oonf-olsrd2/Makefile
index 9494cb3..38c6383 100644
--- a/oonf-olsrd2/Makefile
+++ b/oonf-olsrd2/Makefile
@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=oonf-olsrd2
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/OLSR/OONF.git
diff --git a/oonf-olsrd2/files/olsrd2.init b/oonf-olsrd2/files/olsrd2.init
index 04b30ff..59795c2 100755
--- a/oonf-olsrd2/files/olsrd2.init
+++ b/oonf-olsrd2/files/olsrd2.init
@@ -5,4 +5,7 @@ DAEMON='olsrd2'
[ -n "$IPKG_INSTROOT" ] || {
. /lib/functions/oonf_init.sh
+
+ extra_command "running" "Check if service is running"
+ extra_command "status" "Service status"
}