Add pause/resume commands

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi 2015-08-14 14:19:10 -07:00
parent 15c709ed73
commit bc38c9d1b0
2 changed files with 35 additions and 0 deletions

View File

@ -61,6 +61,8 @@ func main() {
restoreCommand,
killCommand,
specCommand,
pauseCommand,
resumeCommand,
}
app.Before = func(context *cli.Context) error {
if context.GlobalBool("debug") {

33
pause.go Normal file
View File

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