service

package
v0.0.0-...-3bfe646 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Overview

package service implements helpers for working with systemd services

Index

Constants

View Source
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

Disable disables service with the specified name

func IsFailed

func IsFailed(serviceName string) error

IsFailed determines if the specified service has failed. Returns nil error if the service has failed and an error otherwise

func IsStatus

func IsStatus(serviceName string, statuses ...string) error

IsStatus checks whether the specified service has the given active status

func Name

func Name(path string) string

Name returns the unit name part of path

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

func ReinstallOneshotSimple(serviceName string, args ...string) error

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

func ReinstallSimpleService(serviceName string, cmd []string) error

ReinstallSimpleService reinstalls the cmd as a simple service with the specified serviceName.

func Start

func Start(serviceName string) error

Start starts service with the specified name if it's not already running. The service is started in non-blocking mode

func Uninstall

Uninstall uninstalls service with the specified name

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL