Outside of os.exec
calling something, is there anything in the standard library for managing systemd services? I have seen a few 3rd party libraries that hook into dbus or integrate with systemd but I was trying to leverage the standard library as much as possible in this case.
There is no standard library but maybe this can be useful
https://github.com/coreos/go-systemd
I've tested it to just list all units.
package main
import (
"fmt"
"github.com/coreos/go-systemd/dbus"
)
func main() {
systemdConnection, _ := dbus.NewSystemdConnection()
listOfUnits, _ := systemdConnection.ListUnits()
for _, unit := range listOfUnits {
fmt.Println(unit.Name)
}
systemdConnection.Close()
}