From 652c82daa904b81fb947587756b82eda1b86d02a Mon Sep 17 00:00:00 2001 From: YueYue <76854136+ItzMiracleOwO@users.noreply.github.com> Date: Sat, 23 Dec 2023 09:42:58 +0800 Subject: [PATCH] Update linux_service.go Fix service fail to start due to unavaliable network --- cmd/cloudflared/linux_service.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/cloudflared/linux_service.go b/cmd/cloudflared/linux_service.go index 36ae639b..4e68af17 100644 --- a/cmd/cloudflared/linux_service.go +++ b/cmd/cloudflared/linux_service.go @@ -55,7 +55,8 @@ var systemdAllTemplates = map[string]ServiceTemplate{ Path: fmt.Sprintf("/etc/systemd/system/%s", cloudflaredService), Content: `[Unit] Description=cloudflared -After=network.target +After=network-online.target +Wants=network-online.target [Service] TimeoutStartSec=0 @@ -72,7 +73,8 @@ WantedBy=multi-user.target Path: fmt.Sprintf("/etc/systemd/system/%s", cloudflaredUpdateService), Content: `[Unit] Description=Update cloudflared -After=network.target +After=network-online.target +Wants=network-online.target [Service] ExecStart=/bin/bash -c '{{ .Path }} update; code=$?; if [ $code -eq 11 ]; then systemctl restart cloudflared; exit 0; fi; exit $code'