Documentation
¶
Overview ¶
Package systemctl provides a wrapper to control systemd services.
example:
nm, err := systemctl.Unit("NetworkManager.service") if err != nil { // Handle error } if nm.IsActive() { // Handle active service } err = nm.Start() if err != nil { // Handle error }
Index ¶
- func DisableService(name string) error
- func EnableService(name string) error
- func IsActive(name string) (bool, error)
- func IsEnabled(name string) (bool, error)
- func ReloadService(name string) error
- func RestartService(name string) error
- func StartService(name string) error
- func StopService(name string) error
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableService ¶ added in v1.1.0
DisableService function disable the given service in systemd.
func EnableService ¶ added in v1.1.0
EnableService function enables the given service in systemd.
func IsActive ¶ added in v1.1.0
IsActive checks if the given service is running. Returns true if the the given service is active, returns false otherwise.
func IsEnabled ¶ added in v1.1.0
IsEnabled check if the given service is enabled in systemd. Returns true if the the given service is enabled.
func ReloadService ¶ added in v1.1.0
ReloadService function reload the given service with systemctl.
func RestartService ¶ added in v1.1.0
RestartService function restart the given service with systemctl.
func StartService ¶ added in v1.1.0
StartService function start the given service with systemctl.
func StopService ¶ added in v1.1.0
StopService function is stop the given service with systemctl.
Types ¶
type Service ¶
Service provides a struct to store the unit's properties. WILL BE EXPANDED LATER!
func Unit ¶
Unit gives back Service. It checks whether a service with name exist. The struct saves the actual state when the function is called.