mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
f3d0f7054d
Signal systemd when we start shutting down to complement the "READY" notify
that was originally implemented in 97088ebef7
From [sd_notify(3)](https://www.freedesktop.org/software/systemd/man/sd_notify.html#STOPPING=1)
> STOPPING=1
> Tells the service manager that the service is beginning its shutdown. This is useful
> to allow the service manager to track the service's internal state, and present it to
> the user.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
18 lines
588 B
Go
18 lines
588 B
Go
package main
|
|
|
|
import systemdDaemon "github.com/coreos/go-systemd/v22/daemon"
|
|
|
|
// preNotifyReady sends a message to the host when the API is active, but before the daemon is
|
|
func preNotifyReady() {
|
|
}
|
|
|
|
// notifyReady sends a message to the host when the server is ready to be used
|
|
func notifyReady() {
|
|
// Tell the init daemon we are accepting requests
|
|
go systemdDaemon.SdNotify(false, systemdDaemon.SdNotifyReady)
|
|
}
|
|
|
|
// notifyStopping sends a message to the host when the server is shutting down
|
|
func notifyStopping() {
|
|
go systemdDaemon.SdNotify(false, systemdDaemon.SdNotifyStopping)
|
|
}
|