func ctlStop(g *libkb.GlobalContext, components map[string]bool, wait time.Duration) error { if libkb.IsBrewBuild { return ctlBrewStop(g) } runMode := g.Env.GetRunMode() g.Log.Debug("Components: %v", components) errs := []error{} if ok := components[install.ComponentNameApp.String()]; ok { if err := install.TerminateApp(g, g.Log); err != nil { errs = append(errs, err) } } if ok := components[install.ComponentNameService.String()]; ok { if _, err := launchd.Stop(install.DefaultServiceLabel(runMode), wait, g.Log); err != nil { errs = append(errs, err) } } if ok := components[install.ComponentNameKBFS.String()]; ok { if _, err := launchd.Stop(install.DefaultKBFSLabel(runMode), wait, g.Log); err != nil { errs = append(errs, err) } } if ok := components[install.ComponentNameUpdater.String()]; ok { if _, err := launchd.Stop(install.DefaultUpdaterLabel(runMode), wait, g.Log); err != nil { errs = append(errs, err) } } return libkb.CombineErrors(errs...) }
func (v *CmdLaunchdAction) Run() error { switch v.action { case "start": return launchd.Start(v.label, v.G().Log) case "restart": return launchd.Restart(v.label, v.G().Log) case "stop": return launchd.Stop(v.label, true, v.G().Log) case "uninstall": return launchd.Uninstall(v.label, true, v.G().Log) } return nil }
func (v *CmdLaunchdAction) Run() error { switch v.action { case "start": return launchd.Start(v.label, defaultLaunchdWait, v.G().Log) case "restart": return launchd.Restart(v.label, defaultLaunchdWait, v.G().Log) case "stop": _, stopErr := launchd.Stop(v.label, defaultLaunchdWait, v.G().Log) return stopErr case "uninstall": return launchd.Uninstall(v.label, defaultLaunchdWait, v.G().Log) } return nil }
func NewCmdLaunchdStop(cl *libcmdline.CommandLine) cli.Command { return cli.Command{ Name: "stop", ArgumentHelp: "<label>", Usage: "Stop a keybase launchd service", Action: func(c *cli.Context) { args := c.Args() if len(args) < 1 { G.Log.Fatalf("No label specified.") } err := launchd.Stop(args[0]) if err != nil { G.Log.Fatalf("%v", err) } os.Exit(0) }, } }
func NewCmdLaunchdStop(cl *libcmdline.CommandLine, g *libkb.GlobalContext) cli.Command { return cli.Command{ Name: "stop", ArgumentHelp: "<label>", Usage: "Stop a keybase launchd service", Action: func(c *cli.Context) { // TODO: Use ChooseCommand args := c.Args() if len(args) < 1 { g.Log.Fatalf("No label specified.") } err := launchd.Stop(args[0], os.Stdout) if err != nil { g.Log.Fatalf("%v", err) } os.Exit(0) }, } }
func ctlBrewStop(g *libkb.GlobalContext) error { _, err := launchd.Stop(install.DefaultServiceLabel(g.Env.GetRunMode()), defaultLaunchdWait, g.Log) return err }