Add sd_notify to systemd after first sync
This commit is contained in:
1
go.mod
1
go.mod
@@ -6,6 +6,7 @@ require (
|
|||||||
github.com/brotherpowers/ipsubnet v0.0.0-20170914094241-30bc98f0a5b1
|
github.com/brotherpowers/ipsubnet v0.0.0-20170914094241-30bc98f0a5b1
|
||||||
github.com/containers/image/v5 v5.7.0
|
github.com/containers/image/v5 v5.7.0
|
||||||
github.com/containers/storage v1.30.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/creasty/defaults v1.5.2
|
||||||
github.com/fatih/color v1.13.0
|
github.com/fatih/color v1.13.0
|
||||||
github.com/google/uuid v1.1.2
|
github.com/google/uuid v1.1.2
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ After=network-online.target
|
|||||||
AssertFileIsExecutable=@BINDIR@/wwctl
|
AssertFileIsExecutable=@BINDIR@/wwctl
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=forking
|
Type=notify
|
||||||
User=root
|
User=root
|
||||||
Group=root
|
Group=root
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import (
|
|||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/talos-systems/go-smbios/smbios"
|
"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/pidfile"
|
||||||
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
|
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
|
||||||
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
||||||
@@ -149,9 +150,14 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
var finishedInitialSync bool = false
|
||||||
for {
|
for {
|
||||||
updateSystem(conf.Ipaddr, conf.Warewulf.Port, wwid, tag, localUUID)
|
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 {
|
if conf.Warewulf.UpdateInterval > 0 {
|
||||||
time.Sleep(time.Duration(conf.Warewulf.UpdateInterval*1000) * time.Millisecond)
|
time.Sleep(time.Duration(conf.Warewulf.UpdateInterval*1000) * time.Millisecond)
|
||||||
|
|||||||
Reference in New Issue
Block a user