Add sd_notify to systemd after first sync

This commit is contained in:
Christian Goll
2021-12-06 11:03:45 +01:00
parent 2207ef84d9
commit 404490b756
3 changed files with 9 additions and 2 deletions

View File

@@ -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)