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 <f...@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


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to