示例#1
0
文件: manager.go 项目: rened/coreinit
func (m *SystemdManager) getJobStateFromUnit(u *SystemdUnit) *job.JobState {
	loadState, activeState, subState, sockets, err := (*u).State()
	if err != nil {
		log.V(1).Infof("Failed to get state for unit %s", (*u).Name())
		return nil
	} else {
		return job.NewJobState(loadState, activeState, subState, sockets, m.Machine)
	}
}
示例#2
0
文件: target.go 项目: philips/fleet
func (t *Target) GetJobState(name string) *job.JobState {
	info, err := t.Systemd.GetUnitInfo(unitPath(name + ".service"))

	if err != nil {
		return nil
	}

	stateString := info["ActiveState"].Value().(string)
	return job.NewJobState(stateString, t.Machine)
}