func (nc *nspawnCluster) systemdReload() error { conn, err := dbus.New() if err != nil { return err } conn.Reload() return nil }
func NewSystemdManager(machine *machine.Machine, unitPrefix string) *SystemdManager { systemd, err := dbus.New() if err != nil { panic(err) } return &SystemdManager{systemd, machine, unitPrefix, defaultSystemdRuntimePath, systemd.NewSubscriptionSet(), nil} }
func NewSystemdManager(machine *machine.Machine) (*SystemdManager, error) { systemd, err := dbus.New() if err != nil { return nil, err } if err := os.MkdirAll(fleetUnitPath, os.FileMode(0755)); err != nil { return nil, err } return &SystemdManager{systemd, machine, systemd.NewSubscriptionSet(), nil}, nil }
func NewSystemdUnitManager(uDir string) (*SystemdUnitManager, error) { systemd, err := dbus.New() if err != nil { return nil, err } if err := os.MkdirAll(uDir, os.FileMode(0755)); err != nil { return nil, err } mgr := SystemdUnitManager{systemd, uDir, systemd.NewSubscriptionSet()} return &mgr, nil }
func NewSystemdManager(machine *machine.Machine, unitPrefix string) *SystemdManager { systemd, err := dbus.New() if err != nil { panic(err) } name := "fleet-" + machine.State().BootId + ".target" target := NewSystemdTarget(name) mgr := &SystemdManager{systemd, target, machine, unitPrefix, defaultSystemdRuntimePath, systemd.NewSubscriptionSet(), nil} mgr.writeUnit(target.Name(), "") return mgr }
func (nc *nspawnCluster) systemd(unitName, exec string) error { conn, err := dbus.New() if err != nil { return err } props := []dbus.Property{ dbus.PropExecStart(strings.Split(exec, " "), false), } log.Printf("Creating transient systemd unit %s", unitName) if _, err = conn.StartTransientUnit(unitName, "replace", props...); err != nil { log.Printf("Failed creating transient unit %s: %v", unitName, err) return err } _, err = conn.StartUnit(unitName, "replace") if err != nil { log.Printf("Failed starting transient unit %s: %v", unitName, err) } return err }