Merge pull request #135 from runcom/sdnotify

Sdnotify
This commit is contained in:
Mrunal Patel 2016-10-13 11:00:22 -07:00 committed by GitHub
commit da4cc11077
104 changed files with 288 additions and 12880 deletions

View 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()
}

View file

@ -205,6 +205,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)
}