2017-02-07 21:33:23 +00:00
|
|
|
// +build linux
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import "github.com/urfave/cli"
|
|
|
|
|
|
|
|
var pauseCommand = cli.Command{
|
|
|
|
Name: "pause",
|
|
|
|
Usage: "pause suspends all processes inside the container",
|
|
|
|
ArgsUsage: `<container-id>
|
|
|
|
|
|
|
|
Where "<container-id>" is the name for the instance of the container to be
|
|
|
|
paused. `,
|
|
|
|
Description: `The pause command suspends all processes in the instance of the container.
|
|
|
|
|
|
|
|
Use runc list to identiy instances of containers and their current status.`,
|
|
|
|
Action: func(context *cli.Context) error {
|
2017-04-11 15:10:46 +00:00
|
|
|
if err := checkArgs(context, 1, exactArgs); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2017-02-07 21:33:23 +00:00
|
|
|
container, err := getContainer(context)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if err := container.Pause(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2017-04-11 15:10:46 +00:00
|
|
|
|
2017-02-07 21:33:23 +00:00
|
|
|
return nil
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
var resumeCommand = cli.Command{
|
|
|
|
Name: "resume",
|
|
|
|
Usage: "resumes all processes that have been previously paused",
|
|
|
|
ArgsUsage: `<container-id>
|
|
|
|
|
|
|
|
Where "<container-id>" is the name for the instance of the container to be
|
|
|
|
resumed.`,
|
|
|
|
Description: `The resume command resumes all processes in the instance of the container.
|
|
|
|
|
|
|
|
Use runc list to identiy instances of containers and their current status.`,
|
|
|
|
Action: func(context *cli.Context) error {
|
2017-04-11 15:10:46 +00:00
|
|
|
if err := checkArgs(context, 1, exactArgs); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2017-02-07 21:33:23 +00:00
|
|
|
container, err := getContainer(context)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if err := container.Resume(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2017-04-11 15:10:46 +00:00
|
|
|
|
2017-02-07 21:33:23 +00:00
|
|
|
return nil
|
|
|
|
},
|
|
|
|
}
|