diff --git a/nsinit/main.go b/nsinit/main.go index d65c0140..53625ca8 100644 --- a/nsinit/main.go +++ b/nsinit/main.go @@ -53,11 +53,12 @@ func main() { app.Before = preload app.Commands = []cli.Command{ + configCommand, execCommand, initCommand, - statsCommand, - configCommand, + oomCommand, pauseCommand, + statsCommand, unpauseCommand, } diff --git a/nsinit/oom.go b/nsinit/oom.go new file mode 100644 index 00000000..106abeb2 --- /dev/null +++ b/nsinit/oom.go @@ -0,0 +1,28 @@ +package main + +import ( + "log" + + "github.com/codegangsta/cli" + "github.com/docker/libcontainer" +) + +var oomCommand = cli.Command{ + Name: "oom", + Usage: "display oom notifications for a container", + Action: oomAction, +} + +func oomAction(context *cli.Context) { + state, err := libcontainer.GetState(dataPath) + if err != nil { + log.Fatal(err) + } + n, err := libcontainer.NotifyOnOOM(state) + if err != nil { + log.Fatal(err) + } + for _ = range n { + log.Printf("OOM notification received") + } +}