Example #1
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
}
Example #2
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
}
func NewCmdLaunchdRestart(cl *libcmdline.CommandLine) cli.Command {
	return cli.Command{
		Name:         "restart",
		ArgumentHelp: "<label>",
		Usage:        "Restart a keybase launchd service",
		Action: func(c *cli.Context) {
			args := c.Args()
			if len(args) < 1 {
				G.Log.Fatalf("No label specified.")
			}
			err := launchd.Restart(args[0])
			if err != nil {
				G.Log.Fatalf("%v", err)
			}
			os.Exit(0)
		},
	}
}
Example #4
0
func NewCmdLaunchdRestart(cl *libcmdline.CommandLine, g *libkb.GlobalContext) cli.Command {
	return cli.Command{
		Name:         "restart",
		ArgumentHelp: "<label>",
		Usage:        "Restart 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.Restart(args[0], os.Stdout)
			if err != nil {
				g.Log.Fatalf("%v", err)
			}
			os.Exit(0)
		},
	}
}