From d560b83a58a42f9005d3b7ef89d7652af59b17c3 Mon Sep 17 00:00:00 2001 From: twystd Date: Tue, 6 Dec 2022 10:22:16 -0800 Subject: [PATCH] Updated systemd unit file to wait on network-online.target (cf. https://github.com/uhppoted/uhppoted/issues/19) --- CHANGELOG.md | 6 ++++++ commands/daemonize_linux.go | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b3b509..f267b36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # CHANGELOG +## [Unreleased] + +### Changed +1. Updated _systemd_ unit file to wait on `network-online.target` + + ## [0.8.2](https://github.com/uhppoted/uhppoted-rest/releases/tag/v0.8.2) - 2022-10-14 ### Changed diff --git a/commands/daemonize_linux.go b/commands/daemonize_linux.go index a64e0f2..5b9aa78 100644 --- a/commands/daemonize_linux.go +++ b/commands/daemonize_linux.go @@ -38,7 +38,8 @@ type info struct { const serviceTemplate = `[Unit] Description={{.Description}} Documentation={{.Documentation}} -After=syslog.target network.target +After=syslog.target network-online.target +Wants=syslog.target network-online.target [Service] Type=simple @@ -182,6 +183,10 @@ func (cmd *Daemonize) Execute(args ...interface{}) error { fmt.Printf(" > sudo systemctl start %s", SERVICE) fmt.Printf(" > sudo systemctl status %s", SERVICE) fmt.Println() + fmt.Println(" For some system configurations it may be necessary to also enable the service:") + fmt.Println() + fmt.Printf(" > sudo systemctl enable %v\n", SERVICE) + fmt.Println() fmt.Println(" The firewall may need additional rules to allow UDP broadcast e.g. for UFW:") fmt.Println() fmt.Printf(" > sudo ufw allow from %s to any port 60000 proto udp\n", d.BindAddress.IP)