2014-08-13 01:46:43 +08:00
|
|
|
package main
|
2014-06-27 07:44:43 +08:00
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"github.com/codegangsta/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
var pauseCommand = cli.Command{
|
|
|
|
Name: "pause",
|
|
|
|
Usage: "pause the container's processes",
|
|
|
|
Action: pauseAction,
|
|
|
|
}
|
|
|
|
|
|
|
|
var unpauseCommand = cli.Command{
|
|
|
|
Name: "unpause",
|
|
|
|
Usage: "unpause the container's processes",
|
|
|
|
Action: unpauseAction,
|
|
|
|
}
|
|
|
|
|
|
|
|
func pauseAction(context *cli.Context) {
|
2015-01-13 19:52:14 +08:00
|
|
|
container, err := getContainer(context)
|
|
|
|
if err != nil {
|
2014-06-27 07:44:43 +08:00
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
2015-01-13 19:52:14 +08:00
|
|
|
if err = container.Pause(); err != nil {
|
2014-06-27 07:44:43 +08:00
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-13 19:52:14 +08:00
|
|
|
func unpauseAction(context *cli.Context) {
|
|
|
|
container, err := getContainer(context)
|
2014-06-27 07:44:43 +08:00
|
|
|
if err != nil {
|
2015-01-13 19:52:14 +08:00
|
|
|
log.Fatal(err)
|
2014-06-27 07:44:43 +08:00
|
|
|
}
|
|
|
|
|
2015-01-13 19:52:14 +08:00
|
|
|
if err = container.Resume(); err != nil {
|
|
|
|
log.Fatal(err)
|
2014-06-27 07:44:43 +08:00
|
|
|
}
|
|
|
|
}
|