Documentation ¶
Index ¶
- type Service
- func (s *Service) Bootout(removePlist bool) error
- func (s *Service) Bootstrap() ([]byte, error)
- func (s *Service) DefinitionPath() (string, error)
- func (s *Service) Install() (err error)
- func (s *Service) InstallState() *state.Install
- func (s *Service) IsHealthy() bool
- func (s *Service) PollUntil(desired state.RunState, timeout time.Duration) (current *state.Run, timedOut bool)
- func (s *Service) Print() ([]byte, error)
- func (s *Service) RenderPlist() ([]byte, error)
- func (s *Service) RunState() *state.Run
- func (s *Service) Start() error
- func (s *Service) Stop() error
- func (s *Service) UserSpecifier() string
- func (s *Service) WritePlist(content []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct { // Name is the fully qualified name of the service e.g. com.id.doom Name string // ExecutablePath is the absolute path to the executable that will run the service ExecutablePath string // Argv is the list of arguments to pass to ExecutablePath Argv []string // RunAtLoad is whether the service should be started at login RunAtLoad bool // KeepAlive is whether the service should be restarted if it crashes KeepAlive bool }
Service is a LaunchAgent service.
func ForRunningProgram ¶ added in v0.2.0
ForRunningProgram returns a Service with appropriate daemon defaults for the current running executable.
func (*Service) Bootout ¶ added in v0.2.3
Bootout uninstalls a service (`launchctl bootout` née `launchctl unload`) Optionally deletes the service definition file (plist) as well.
func (*Service) DefinitionPath ¶
DefinitionPath is the absolute fs path where the service's plist config lives
func (*Service) Install ¶
Install sets up a new service by writing a plist file and telling launchd about it. It also starts the service and waits for it to come up if RunAtLoad is true.
func (*Service) InstallState ¶
InstallState returns information about whether or not a service is installed.
func (*Service) PollUntil ¶
func (s *Service) PollUntil(desired state.RunState, timeout time.Duration) (current *state.Run, timedOut bool)
PollUntil polls the service until it reaches the desired state or the timeout is reached.
func (*Service) RenderPlist ¶ added in v0.2.0
RenderPlist returns the contents of a plist file content for a launchd service.
func (*Service) UserSpecifier ¶
UserSpecifier unambiguously identifies the service in subcommands. e.g. gui/501/com.id.doom See launchctl(1).
func (*Service) WritePlist ¶ added in v0.2.0
WritePlist writes the contents of the service's plist file content to the appropriate directory.