Beispiel #1
0
func (c *CmdStatus) osSpecific(status *fstatus) error {
	serviceStatus := install.KeybaseServiceStatus(c.G(), "service")
	kbfsStatus := install.KeybaseServiceStatus(c.G(), "kbfs")

	if len(serviceStatus.Pid) > 0 {
		status.Service.Running = true
		status.Service.Pid = serviceStatus.Pid
	}

	if len(kbfsStatus.Pid) > 0 {
		status.KBFS.Running = true
		status.KBFS.Pid = kbfsStatus.Pid
	}

	return nil
}
Beispiel #2
0
func (c *CtlHandler) stopLaunchd() {
	status := install.KeybaseServiceStatus(c.G(), c.G().Env.GetLabel())
	if status.Pid == "" {
		c.G().Log.Debug("Service does not appear to be running via launchd (label = %q)", c.G().Env.GetLabel())
		return
	}

	c.G().Log.Debug("Removing %s from launchd", status.Label)
	svc := launchd.NewService(status.Label)
	if err := svc.Stop(false); err != nil {
		c.G().Log.Warning("error stopping launchd service:", err)
	}
}
Beispiel #3
0
func (v *CmdLaunchdStatus) Run() error {
	var st keybase1.ServiceStatus
	if v.name == "service" {
		st = install.KeybaseServiceStatus(v.G(), v.label)
	} else if v.name == "kbfs" {
		st = install.KBFSServiceStatus(v.G(), v.label)
	} else {
		return fmt.Errorf("Invalid service name: %s", v.name)
	}

	if v.format == "json" {
		out, err := json.MarshalIndent(st, "", "  ")
		if err != nil {
			return err
		}
		fmt.Fprintf(os.Stdout, "%s\n", out)
	} else if v.format == "" {

		fmt.Fprintf(os.Stdout, "%#v\n", st)
	}
	return nil
}