Add support for sd_notify
Signed-off-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
c1b9838af5
commit
09bed25074
4 changed files with 56 additions and 0 deletions
20
cmd/server/daemon_linux.go
Normal file
20
cmd/server/daemon_linux.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
// +build linux
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/Sirupsen/logrus"
|
||||
systemdDaemon "github.com/coreos/go-systemd/daemon"
|
||||
)
|
||||
|
||||
func sdNotify() {
|
||||
if err := systemdDaemon.SdNotify("READY=1"); err != nil {
|
||||
logrus.Warnf("Failed to sd_notify systemd: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// notifySystem sends a message to the host when the server is ready to be used
|
||||
func notifySystem() {
|
||||
// Tell the init daemon we are accepting requests
|
||||
go sdNotify()
|
||||
}
|
|
@ -188,6 +188,10 @@ func main() {
|
|||
|
||||
runtime.RegisterRuntimeServiceServer(s, service)
|
||||
runtime.RegisterImageServiceServer(s, service)
|
||||
|
||||
// after the daemon is done setting up we can notify systemd api
|
||||
notifySystem()
|
||||
|
||||
if err := s.Serve(lis); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue