forked from coreos/fleet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stop.go
36 lines (28 loc) · 805 Bytes
/
stop.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
import (
"path"
"github.com/coreos/fleet/third_party/github.com/codegangsta/cli"
)
func newStopUnitCommand() cli.Command {
return cli.Command{
Name: "stop",
Usage: "Halt one or more units in the cluster",
Description: `Stop one or more units from running in the cluster, but allow them to be
started again in the future.
Instructs systemd on the host machine to stop the unit, deferring to systemd
completely for any custom stop directives (i.e. ExecStop option in the unit
file).
Stop a single unit:
fleetctl stop foo.service
Stop an entire directory of units with glob matching:
fleetctl stop myservice/*`,
Action: stopUnitAction,
}
}
func stopUnitAction(c *cli.Context) {
r := getRegistry(c)
for _, v := range c.Args() {
name := path.Base(v)
r.StopJob(name)
}
}