Documentation
¶
Overview ¶
Package service installs the visor as a user service and dials it. The visor has its own service, separate from the product service, because launchd stops the whole process group of a job.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUnsupportedOS = errors.New("service: this OS is not supported")
ErrUnsupportedOS means that the OS has no service manager that the package knows.
Functions ¶
func Ensure ¶
Ensure dials the visor. When no visor listens, it installs and starts the service, then waits for the socket.
func UserUnitDir ¶
UserUnitDir gives the folder of the user services for goos.
Types ¶
type Service ¶
type Service struct {
// Label names the service, for example com.example.visor.
Label string
// Command starts the visor in the foreground, for example
// [binary, "visor", "serve"].
Command []string
// Socket is the socket that the visor listens on.
Socket string
// UnitDir holds the unit file. See UserUnitDir.
UnitDir string
// LogPath gets the output of the visor process. Empty discards it.
LogPath string
// Env is the env of the visor process. The unit file has mode 0600.
Env map[string]string
// GOOS selects launchd (darwin) or systemd (linux). Empty is the OS of
// this process.
GOOS string
// Wait is how long Ensure waits for the socket. Zero is 15 s.
Wait time.Duration
// Run runs a service manager command. Nil runs the program.
Run func(ctx context.Context, name string, args ...string) error
}
Service describes the visor service of one product.
Click to show internal directories.
Click to hide internal directories.