diff --git a/go.mod b/go.mod index a939665a..08cc3e1c 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/brotherpowers/ipsubnet v0.0.0-20170914094241-30bc98f0a5b1 github.com/containers/image/v5 v5.7.0 github.com/containers/storage v1.30.0 + github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e github.com/creasty/defaults v1.5.2 github.com/fatih/color v1.13.0 github.com/google/uuid v1.1.2 diff --git a/include/systemd/warewulfd.service.in b/include/systemd/warewulfd.service.in index 20bd6367..65981fcb 100644 --- a/include/systemd/warewulfd.service.in +++ b/include/systemd/warewulfd.service.in @@ -5,7 +5,7 @@ After=network-online.target AssertFileIsExecutable=@BINDIR@/wwctl [Service] -Type=forking +Type=notify User=root Group=root diff --git a/internal/app/wwclient/root.go b/internal/app/wwclient/root.go index 7d911c8a..6470f112 100644 --- a/internal/app/wwclient/root.go +++ b/internal/app/wwclient/root.go @@ -16,6 +16,7 @@ import ( "github.com/google/uuid" "github.com/talos-systems/go-smbios/smbios" + "github.com/coreos/go-systemd/daemon" "github.com/hpcng/warewulf/internal/pkg/pidfile" "github.com/hpcng/warewulf/internal/pkg/warewulfconf" "github.com/hpcng/warewulf/internal/pkg/wwlog" @@ -149,9 +150,14 @@ func CobraRunE(cmd *cobra.Command, args []string) error { os.Exit(0) } }() - + var finishedInitialSync bool = false for { updateSystem(conf.Ipaddr, conf.Warewulf.Port, wwid, tag, localUUID) + if !finishedInitialSync { + // ignore error and status here, as this wouldn't change anything + _, _ = daemon.SdNotify(false, daemon.SdNotifyReady) + finishedInitialSync = true + } if conf.Warewulf.UpdateInterval > 0 { time.Sleep(time.Duration(conf.Warewulf.UpdateInterval*1000) * time.Millisecond)