[PATCH v2 2/5] base-files: add restart function wrapper
Florian Eckert
fe at dev.tdt.de
Thu Dec 17 04:35:34 EST 2020
Thies commit add the new wrapper function to rc.common to execute the new ubus
service method "restart" on a service restart.
Signed-off-by: Florian Eckert <fe at dev.tdt.de>
---
package/base-files/files/etc/rc.common | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/package/base-files/files/etc/rc.common b/package/base-files/files/etc/rc.common
index f39b69464e..ad5af4b7a1 100755
--- a/package/base-files/files/etc/rc.common
+++ b/package/base-files/files/etc/rc.common
@@ -139,6 +139,19 @@ extra_command "enabled" "Check if service is started on boot"
fi
}
+ restart() {
+ if eval "type restart_service" 2>/dev/null >/dev/null; then
+ restart_service "$@"
+ else
+ trap '' TERM
+ stop "$@"
+ trap - TERM
+ start "$@"
+ fi
+ procd_open_service "$(basename ${basescript:-$initscript})" "$initscript"
+ procd_close_service "restart"
+ }
+
trace() {
TRACE_SYSCALLS=1
start "$@"
--
2.20.1
More information about the openwrt-devel
mailing list