etcdmain: log "SdNotify" error/success

I am seeing some silent failures around systemd service.
This will help find out bugs in "go-systemd"

Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
release-3.5
Gyuho Lee 2020-03-24 12:20:20 -07:00
parent 0eee733220
commit 2329acf05b
1 changed files with 7 additions and 3 deletions

View File

@ -47,10 +47,14 @@ func Main() {
}
func notifySystemd(lg *zap.Logger) {
if lg == nil {
lg = zap.NewExample()
}
lg.Info("notifying init daemon")
_, err := daemon.SdNotify(false, daemon.SdNotifyReady)
if err != nil {
if lg != nil {
lg.Error("failed to notify systemd for readiness", zap.Error(err))
}
lg.Error("failed to notify systemd for readiness", zap.Error(err))
return
}
lg.Info("successfully notified init daemon")
}