Esempio n. 1
0
func ctlStart(g *libkb.GlobalContext, components map[string]bool) error {
	if libkb.IsBrewBuild {
		return ctlBrewStart(g)
	}
	runMode := g.Env.GetRunMode()
	g.Log.Debug("Components: %v", components)
	errs := []error{}
	if ok := components[install.ComponentNameService.String()]; ok {
		if err := startLaunchdService(g, install.DefaultServiceLabel(runMode), g.Env.GetServiceInfoPath(), true); err != nil {
			errs = append(errs, err)
			g.Log.Errorf("%s", err)
		}
	}
	if ok := components[install.ComponentNameKBFS.String()]; ok {
		if err := startLaunchdService(g, install.DefaultKBFSLabel(runMode), g.Env.GetKBFSInfoPath(), true); err != nil {
			errs = append(errs, err)
			g.Log.Errorf("%s", err)
		}
	}
	if ok := components[install.ComponentNameUpdater.String()]; ok {
		if err := launchd.Start(install.DefaultUpdaterLabel(runMode), defaultLaunchdWait, g.Log); err != nil {
			errs = append(errs, err)
			g.Log.Errorf("%s", err)
		}
	}
	if ok := components[install.ComponentNameApp.String()]; ok {
		if err := install.RunApp(g, g.Log); err != nil {
			errs = append(errs, err)
			g.Log.Errorf("%s", err)
		}
	}
	return libkb.CombineErrors(errs...)
}
Esempio n. 2
0
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
}
Esempio n. 3
0
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
}
Esempio n. 4
0
func NewCmdLaunchdStart(cl *libcmdline.CommandLine) cli.Command {
	return cli.Command{
		Name:         "start",
		ArgumentHelp: "<label>",
		Usage:        "Start a keybase launchd service",
		Action: func(c *cli.Context) {
			args := c.Args()
			if len(args) < 1 {
				G.Log.Fatalf("No label specified")
			}
			err := launchd.Start(args[0])
			if err != nil {
				G.Log.Fatalf("%v", err)
			}
			os.Exit(0)
		},
	}
}
Esempio n. 5
0
func NewCmdLaunchdStart(cl *libcmdline.CommandLine, g *libkb.GlobalContext) cli.Command {
	return cli.Command{
		Name:         "start",
		ArgumentHelp: "<label>",
		Usage:        "Start 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.Start(args[0], os.Stdout)
			if err != nil {
				g.Log.Fatalf("%v", err)
			}
			os.Exit(0)
		},
	}
}