cloudflared: reload service if wan inferface has (re)connected
authorTianling Shen <cnsztl@immortalwrt.org>
Sat, 31 Aug 2024 13:53:39 +0000 (21:53 +0800)
committerTianling Shen <cnsztl@immortalwrt.org>
Fri, 6 Sep 2024 14:49:28 +0000 (22:49 +0800)
Sometimes the wan connection needs time to be established (e.g. cold
boot after power loss) and the service may crash as the internet is
yet available. Add a trigger to reload the service once the wan
interface is up.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
(cherry picked from commit 52037eb625a864c7e9b2b4e30b975bc5a8092192)
[based upon 23.05 branch]
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
net/cloudflared/Makefile
net/cloudflared/files/cloudflared.init

index b49ba6282fa7488e1f63067264eb24afafa9e6c8..c85b23f2ffddf2befd35901ed9b3c13e9bcb9292 100644 (file)
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=cloudflared
 PKG_VERSION:=2024.4.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://codeload.github.com/cloudflare/cloudflared/tar.gz/$(PKG_VERSION)?
index ffef8d0931c3de6a917b755f79e9ccd620e61a63..35794b3687292890e1c2f1cba21e9d4f7de6e9a5 100755 (executable)
@@ -53,4 +53,5 @@ reload_service() {
 
 service_triggers() {
        procd_add_reload_trigger "$CONF"
+       procd_add_interface_trigger "interface.*.up" "wan" /etc/init.d/cloudflared restart
 }