Documentation ¶
Index ¶
- func Install(plist Plist, wait time.Duration, log Log) error
- func PlistDestination(label string) string
- func Restart(label string, wait time.Duration, log Log) error
- func ShowStatus(label string, log Log) error
- func Start(label string, wait time.Duration, log Log) error
- func Stop(label string, wait time.Duration, log Log) (bool, error)
- func Uninstall(label string, wait time.Duration, log Log) error
- type EnvVar
- type Log
- type Plist
- type Service
- func (s Service) CheckPlist(plist Plist) (bool, error)
- func (s Service) HasPlist() bool
- func (s Service) Install(p Plist, wait time.Duration) error
- func (s Service) Label() string
- func (s Service) LoadStatus() (*ServiceStatus, error)
- func (s Service) PlistDestination() string
- func (s Service) Restart(wait time.Duration) error
- func (s *Service) SetLogger(log Log)
- func (s Service) Start(wait time.Duration) error
- func (s Service) StatusDescription() string
- func (s Service) Stop(wait time.Duration) (bool, error)
- func (s Service) Uninstall(wait time.Duration) error
- func (s Service) WaitForExit(wait time.Duration) error
- func (s Service) WaitForStatus(wait time.Duration, delay time.Duration) (*ServiceStatus, error)
- type ServiceStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PlistDestination ¶
PlistDestination is the plist path for a label
func ShowStatus ¶
ShowStatus shows status info for a service
Types ¶
type EnvVar ¶
type EnvVar struct {
// contains filtered or unexported fields
}
EnvVar defines and environment variable for the Plist
type Plist ¶
type Plist struct {
// contains filtered or unexported fields
}
Plist defines a launchd plist
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service defines a service
func ListServices ¶
ListServices will return service with label that starts with a filter string.
func (Service) CheckPlist ¶
CheckPlist returns false, if the plist destination doesn't match what we would install. This means the plist is old and we need to update it.
func (Service) LoadStatus ¶
func (s Service) LoadStatus() (*ServiceStatus, error)
LoadStatus returns service status
func (Service) PlistDestination ¶
PlistDestination is the service plist path
func (Service) StatusDescription ¶
StatusDescription returns the service status description
func (Service) Stop ¶
Stop a service. Returns true, nil on successful stop. If false, nil is returned it means there was nothing to stop.
func (Service) WaitForExit ¶
WaitForExit waits for service to exit
func (Service) WaitForStatus ¶ added in v1.0.16
WaitForStatus waits for service status to be available
type ServiceStatus ¶
type ServiceStatus struct {
// contains filtered or unexported fields
}
ServiceStatus defines status for a service
func (ServiceStatus) Description ¶
func (s ServiceStatus) Description() string
Description returns service status info
func (ServiceStatus) HasRun ¶ added in v1.0.17
func (s ServiceStatus) HasRun() bool
HasRun returns true if service is running, or has run and failed
func (ServiceStatus) IsErrored ¶ added in v1.0.17
func (s ServiceStatus) IsErrored() bool
IsErrored is true if the service errored trying to start
func (ServiceStatus) IsRunning ¶
func (s ServiceStatus) IsRunning() bool
IsRunning is true if the service is running (with a pid)
func (ServiceStatus) LastExitStatus ¶
func (s ServiceStatus) LastExitStatus() string
LastExitStatus will be blank if pid > 0, or a number "123"
func (ServiceStatus) Pid ¶
func (s ServiceStatus) Pid() string
Pid for status (empty string if not running)