aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/etc
diff options
context:
space:
mode:
authorArthur Skowronek <ags@digineo.de>2019-01-30 14:58:47 +0100
committerPetr Štetiar <ynezz@true.cz>2019-05-05 21:11:01 +0200
commitfc23bcdaa2f011ef47e2f6c6c1babad6fbdc3e7d (patch)
tree0bfeb7bdfb6dc3ce6472b26bd6ab2a9b1510d9c1 /package/base-files/files/etc
parent3b4c44aa8b8715bef8e4f4ce63c3a24f2cb22b6c (diff)
downloadupstream-fc23bcdaa2f011ef47e2f6c6c1babad6fbdc3e7d.tar.gz
upstream-fc23bcdaa2f011ef47e2f6c6c1babad6fbdc3e7d.tar.bz2
upstream-fc23bcdaa2f011ef47e2f6c6c1babad6fbdc3e7d.zip
base-files: add service_stopped as a post stop hook
Purpose of these changes is to introduce a hook for post service shutdown in a similar fashion to the existing hook service_started. I found it to be useful to specify a hook that is called once the service has been stopped and not before the service is stopped like the stop_service hook does. The concrete use case I have for this is that I'm running a binary that takes over the hardware watchdog timer. Said binary unfortunately can not use ubus directly to tell procd to hand over the watchdog timer so this has to be done in the service file for the binary in question. In order to support a clean handover of the watchdog timer back to procd, the service init script has to dispatch the ubus invocation once the binary in question has been stopped. Signed-off-by: Arthur Skowronek <ags@digineo.de> Signed-off-by: Petr Štetiar <ynezz@true.cz> [added commit message, use the same form as other hooks]
Diffstat (limited to 'package/base-files/files/etc')
-rwxr-xr-xpackage/base-files/files/etc/rc.common3
1 files changed, 3 insertions, 0 deletions
diff --git a/package/base-files/files/etc/rc.common b/package/base-files/files/etc/rc.common
index d9773a0c5a..75dbeedf34 100755
--- a/package/base-files/files/etc/rc.common
+++ b/package/base-files/files/etc/rc.common
@@ -131,6 +131,9 @@ ${INIT_TRACE:+set -x}
procd_lock
stop_service "$@"
procd_kill "$(basename ${basescript:-$initscript})" "$1"
+ if eval "type service_stopped" 2>/dev/null >/dev/null; then
+ service_stopped
+ fi
}
reload() {