Update linux_service.go
Fix service fail to start due to unavaliable network
This commit is contained in:
parent
a6760a6cbf
commit
652c82daa9
|
@ -55,7 +55,8 @@ var systemdAllTemplates = map[string]ServiceTemplate{
|
||||||
Path: fmt.Sprintf("/etc/systemd/system/%s", cloudflaredService),
|
Path: fmt.Sprintf("/etc/systemd/system/%s", cloudflaredService),
|
||||||
Content: `[Unit]
|
Content: `[Unit]
|
||||||
Description=cloudflared
|
Description=cloudflared
|
||||||
After=network.target
|
After=network-online.target
|
||||||
|
Wants=network-online.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
TimeoutStartSec=0
|
TimeoutStartSec=0
|
||||||
|
@ -72,7 +73,8 @@ WantedBy=multi-user.target
|
||||||
Path: fmt.Sprintf("/etc/systemd/system/%s", cloudflaredUpdateService),
|
Path: fmt.Sprintf("/etc/systemd/system/%s", cloudflaredUpdateService),
|
||||||
Content: `[Unit]
|
Content: `[Unit]
|
||||||
Description=Update cloudflared
|
Description=Update cloudflared
|
||||||
After=network.target
|
After=network-online.target
|
||||||
|
Wants=network-online.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/bin/bash -c '{{ .Path }} update; code=$?; if [ $code -eq 11 ]; then systemctl restart cloudflared; exit 0; fi; exit $code'
|
ExecStart=/bin/bash -c '{{ .Path }} update; code=$?; if [ $code -eq 11 ]; then systemctl restart cloudflared; exit 0; fi; exit $code'
|
||||||
|
|
Loading…
Reference in New Issue