INNER CODE UNIT · Go

main

superedge/superedge · hack/update-lite-apiserver/main.go:32

func main() {
	systemctl, err := dbus.New()
	if err != nil {
		fmt.Printf("Create systemctl failed: %s\n", err.Error())
		os.Exit(1)
	}
	if action == "status" {
		units, err := systemctl.ListUnits()
		if err != nil {
			fmt.Printf("systemctl status %s failed: %s\n", service, err.Error())
			os.Exit(1)
		}
		for _, unit := range units {
			if unit.Name == service {
				if unit.ActiveState == "active" {
					fmt.Printf("service status is active\n")
					return
				} else {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…