diff --git a/pkg/cli/server/server.go b/pkg/cli/server/server.go index d38480950ae7..3f192c45a6a9 100644 --- a/pkg/cli/server/server.go +++ b/pkg/cli/server/server.go @@ -418,6 +418,8 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont logrus.Info("Starting " + version.Program + " " + app.App.Version) + notifySocket := os.Getenv("NOTIFY_SOCKET") + ctx := signals.SetupSignalHandler(context.Background()) if err := server.StartServer(ctx, &serverConfig, cfg); err != nil { @@ -434,7 +436,8 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont } logrus.Info(version.Program + " is up and running") - if (cfg.DisableAgent || cfg.DisableAPIServer) && os.Getenv("NOTIFY_SOCKET") != "" { + if (cfg.DisableAgent || cfg.DisableAPIServer) && notifySocket != "" { + os.Setenv("NOTIFY_SOCKET", notifySocket) systemd.SdNotify(true, "READY=1\n") } }()