Skip to content

Commit face52c

Browse files
committed
Merge pull request #204 from tonistiigi/pause-unpause
Add pause/resume commands
2 parents 4a478a9 + bc38c9d commit face52c

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+
resumeCommand,
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 resumeCommand = cli.Command{
22+
Name: "resume",
23+
Usage: "resume 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)