Skip to content

Commit

Permalink
Update linux_service.go
Browse files Browse the repository at this point in the history
Fix service fail to start due to unavaliable network
  • Loading branch information
YueMiyuki authored and joliveirinha committed Mar 6, 2024
1 parent a6760a6 commit 652c82d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/cloudflared/linux_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand Down

0 comments on commit 652c82d

Please sign in to comment.