Documentation ¶
Overview ¶
package service implements helpers for working with systemd services
Index ¶
- Constants
- func Disable(req systemservice.DisableServiceRequest) error
- func IsFailed(serviceName string) error
- func IsStatus(serviceName string, statuses ...string) error
- func Name(path string) string
- func Reinstall(req systemservice.NewServiceRequest) error
- func ReinstallOneshot(req systemservice.NewServiceRequest) error
- func ReinstallOneshotSimple(serviceName string, args ...string) error
- func ReinstallSimpleService(serviceName string, cmd []string) error
- func Start(serviceName string) error
- func Uninstall(req systemservice.UninstallServiceRequest) error
Constants ¶
const ( // OneshotService is a service that executes one time OneshotService = "oneshot" // SimpleService is a simple service that is recommended for long running processes SimpleService = "simple" // RestartOnFailure defines the restart on-failure rule for a service RestartOnFailure = "on-failure" )
Systemd service unit configuration constants More documentation on configuration can be found here: https://www.freedesktop.org/software/systemd/man/systemd.service.html
Variables ¶
This section is empty.
Functions ¶
func Disable ¶
func Disable(req systemservice.DisableServiceRequest) error
Disable disables service with the specified name
func IsFailed ¶
IsFailed determines if the specified service has failed. Returns nil error if the service has failed and an error otherwise
func Reinstall ¶
func Reinstall(req systemservice.NewServiceRequest) error
Reinstall installs a systemd service specified with req. It will attempt to remove the previous service with the name specified in request. The operation is non-blocking and returns without waiting for service to start
func ReinstallOneshot ¶
func ReinstallOneshot(req systemservice.NewServiceRequest) error
ReinstallOneshot installs a systemd service specified with req. The operation is non-blocking and returns without waiting for service to start
func ReinstallOneshotSimple ¶
ReinstallOneshotSimple installs a systemd service named serviceName of type=oneshot using args as arguments to the gravity binary. The service will use the same binary as running this process. The service will also be configured to appear running after exit (https://www.freedesktop.org/software/systemd/man/systemd.service.html#RemainAfterExit=). The operation is non-blocking and returns without waiting for service to start
func ReinstallSimpleService ¶
ReinstallSimpleService reinstalls the cmd as a simple service with the specified serviceName.
func Start ¶
Start starts service with the specified name if it's not already running. The service is started in non-blocking mode
func Uninstall ¶
func Uninstall(req systemservice.UninstallServiceRequest) error
Uninstall uninstalls service with the specified name
Types ¶
This section is empty.