Skip to content

Commit a73719e

Browse files
committed
Add pause/unpause commands
1 parent 15c709e commit a73719e

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

main.go

+2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ func main() {
6161
restoreCommand,
6262
killCommand,
6363
specCommand,
64+
pauseCommand,
65+
unpauseCommand,
6466
}
6567
app.Before = func(context *cli.Context) error {
6668
if context.GlobalBool("debug") {

pause.go

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// +build linux
2+
3+
package main
4+
5+
import "github.com/codegangsta/cli"
6+
7+
var pauseCommand = cli.Command{
8+
Name: "pause",
9+
Usage: "pause suspends all processes inside the container",
10+
Action: func(context *cli.Context) {
11+
container, err := getContainer(context)
12+
if err != nil {
13+
fatal(err)
14+
}
15+
if err := container.Pause(); err != nil {
16+
fatal(err)
17+
}
18+
},
19+
}
20+
21+
var unpauseCommand = cli.Command{
22+
Name: "unpause",
23+
Usage: "unpause resumes all processes that have been previously paused",
24+
Action: func(context *cli.Context) {
25+
container, err := getContainer(context)
26+
if err != nil {
27+
fatal(err)
28+
}
29+
if err := container.Resume(); err != nil {
30+
fatal(err)
31+
}
32+
},
33+
}

0 commit comments

Comments
 (0)