Documentation
¶
Overview ¶
runit manages services usually found in /etc/service or /service, which are soft links to the actual service directories in /etc/sv:
<service_name>/
run
log/
run
supervise/
pid # => 4994
stat # => run / down
Index ¶
Constants ¶
View Source
const ( Unknown Status = "Unknown" Down = "Down" Starting = "Starting" Up = "Up" )
Variables ¶
View Source
var ErrServiceNotFound = errors.New("No such service")
View Source
var ( SupportedInits = []func() (InitSystem, error){ func() (InitSystem, error) { return detectLaunchd("/") }, func() (InitSystem, error) { return detectUpstart("/etc/init") }, func() (InitSystem, error) { return detectRunit("/") }, func() (InitSystem, error) { return detectSystemd("/etc/systemd") }, } )
Functions ¶
This section is empty.
Types ¶
type InitSystem ¶
type InitSystem interface {
// Name of the init system: "upstart", "runit", etc.
Name() string
// Find the process info for a given service name. All errors
// returned must be of type ServiceError.
LookupService(name string) (*ProcessStatus, error)
// Restart the process associated with the given service name. All errors
// returned must be of type ServiceError.
Restart(name string) error
}
Your init system(s) manages services. We use the init system to: 1. find the associated process 2. restart the service
func Detect ¶
func Detect() []InitSystem
type Launchd ¶
type Launchd struct {
// contains filtered or unexported fields
}
func (*Launchd) LookupService ¶
func (l *Launchd) LookupService(serviceName string) (*ProcessStatus, error)
type MockInitSystem ¶
type MockInitSystem struct {
Actions []string
CurrentStatus *ProcessStatus
}
func MockInit ¶
func MockInit() *MockInitSystem
func (*MockInitSystem) LookupService ¶
func (m *MockInitSystem) LookupService(name string) (*ProcessStatus, error)
func (*MockInitSystem) Name ¶
func (m *MockInitSystem) Name() string
func (*MockInitSystem) Restart ¶
func (m *MockInitSystem) Restart(name string) error
type ProcessStatus ¶
func NewStatus ¶
func NewStatus() *ProcessStatus
func (*ProcessStatus) String ¶
func (s *ProcessStatus) String() string
type Runit ¶
type Runit struct {
// contains filtered or unexported fields
}
func (*Runit) LookupService ¶
func (r *Runit) LookupService(serviceName string) (*ProcessStatus, error)
type ServiceError ¶
func (*ServiceError) Error ¶
func (e *ServiceError) Error() string
type Systemd ¶
type Systemd struct {
// contains filtered or unexported fields
}
func (*Systemd) LookupService ¶
func (u *Systemd) LookupService(serviceName string) (*ProcessStatus, error)
type Upstart ¶
type Upstart struct {
// contains filtered or unexported fields
}
func (*Upstart) LookupService ¶
func (u *Upstart) LookupService(serviceName string) (*ProcessStatus, error)
Click to show internal directories.
Click to hide internal directories.