From bc38c9d1b0c6cced5796ad27830f10c1a69de237 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Fri, 14 Aug 2015 14:19:10 -0700 Subject: [PATCH] Add pause/resume commands Signed-off-by: Tonis Tiigi --- main.go | 2 ++ pause.go | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 pause.go diff --git a/main.go b/main.go index 1118fa52..7187c754 100644 --- a/main.go +++ b/main.go @@ -61,6 +61,8 @@ func main() { restoreCommand, killCommand, specCommand, + pauseCommand, + resumeCommand, } app.Before = func(context *cli.Context) error { if context.GlobalBool("debug") { diff --git a/pause.go b/pause.go new file mode 100644 index 00000000..e1086e7f --- /dev/null +++ b/pause.go @@ -0,0 +1,33 @@ +// +build linux + +package main + +import "github.com/codegangsta/cli" + +var pauseCommand = cli.Command{ + Name: "pause", + Usage: "pause suspends all processes inside the container", + Action: func(context *cli.Context) { + container, err := getContainer(context) + if err != nil { + fatal(err) + } + if err := container.Pause(); err != nil { + fatal(err) + } + }, +} + +var resumeCommand = cli.Command{ + Name: "resume", + Usage: "resume resumes all processes that have been previously paused", + Action: func(context *cli.Context) { + container, err := getContainer(context) + if err != nil { + fatal(err) + } + if err := container.Resume(); err != nil { + fatal(err) + } + }, +}