diff --git a/cmd/frostfs-ir/main.go b/cmd/frostfs-ir/main.go index 5b852c37c..02936ae78 100644 --- a/cmd/frostfs-ir/main.go +++ b/cmd/frostfs-ir/main.go @@ -13,6 +13,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/misc" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" + "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/sdnotify" "github.com/spf13/viper" "go.uber.org/zap" ) @@ -124,4 +125,8 @@ func shutdown() { zap.String("error", err.Error()), ) } + + if err := sdnotify.ClearStatus(); err != nil { + log.Error(logs.FailedToReportStatusToSystemd, zap.Error(err)) + } } diff --git a/cmd/frostfs-node/config.go b/cmd/frostfs-node/config.go index cdfabdebd..f98f1c1a3 100644 --- a/cmd/frostfs-node/config.go +++ b/cmd/frostfs-node/config.go @@ -1398,4 +1398,8 @@ func (c *cfg) shutdown() { for i := range c.closers { c.closers[len(c.closers)-1-i].fn() } + + if err := sdnotify.ClearStatus(); err != nil { + c.log.Error(logs.FailedToReportStatusToSystemd, zap.Error(err)) + } } diff --git a/pkg/util/sdnotify/sdnotify.go b/pkg/util/sdnotify/sdnotify.go index 5235315cc..e94ff77ad 100644 --- a/pkg/util/sdnotify/sdnotify.go +++ b/pkg/util/sdnotify/sdnotify.go @@ -69,6 +69,11 @@ func Status(status string) error { return Send("STATUS=" + status) } +// ClearStatus resets the current service status previously set by Status. +func ClearStatus() error { + return Status("") +} + // Send state through the notify socket if any. // If the notify socket was not detected, it returns an error. func Send(state string) error {