Documentation
¶
Index ¶
- Constants
- func AddConfigChangeMonitor(path string, filePattern string, ...)
- func AddProgramChangeMonitor(path string, ...)
- func NewProcCollector(mgr *Manager) *procCollector
- func PathExpand(path string) (string, error)
- type Manager
- func (pm *Manager) Add(name string, proc *Process)
- func (pm *Manager) AsyncForEachProcess(procFunc func(p *Process), done chan *Process) int
- func (pm *Manager) Clear()
- func (pm *Manager) CreateProcess(supervisorID string, config *config.Entry) *Process
- func (pm *Manager) Find(name string) *Process
- func (pm *Manager) FindMatch(name string) []*Process
- func (pm *Manager) ForEachProcess(procFunc func(p *Process))
- func (pm *Manager) Remove(name string) *Process
- func (pm *Manager) StartAutoStartPrograms()
- func (pm *Manager) StopAllProcesses()
- type Process
- func (p *Process) GetDescription() string
- func (p *Process) GetExitstatus() int
- func (p *Process) GetGroup() string
- func (p *Process) GetName() string
- func (p *Process) GetPid() int
- func (p *Process) GetPriority() int
- func (p *Process) GetStartTime() time.Time
- func (p *Process) GetState() State
- func (p *Process) GetStatus() string
- func (p *Process) GetStderrLogfile() string
- func (p *Process) GetStdoutLogfile() string
- func (p *Process) GetStopTime() time.Time
- func (p *Process) SendProcessStdin(chars string) error
- func (p *Process) Signal(sig os.Signal, sigChildren bool) error
- func (p *Process) Start(wait bool)
- func (p *Process) Stop(wait bool)
- type State
Constants ¶
const ( // Stopped the stopped state Stopped State = iota // Starting the starting state Starting = 10 // Running the running state Running = 20 // Backoff the backoff state Backoff = 30 // Stopping the stopping state Stopping = 40 // Exited the Exited state Exited = 100 // Fatal the Fatal state Fatal = 200 // Unknown the unknown state Unknown = 1000 )
Variables ¶
This section is empty.
Functions ¶
func AddConfigChangeMonitor ¶
func AddConfigChangeMonitor(path string, filePattern string, fileChangeCb func(path string, mode filechangemonitor.FileChangeMode))
AddConfigChangeMonitor adds program change listener to monitor if any of its configuration files is changed
func AddProgramChangeMonitor ¶
func AddProgramChangeMonitor(path string, fileChangeCb func(path string, mode filechangemonitor.FileChangeMode))
AddProgramChangeMonitor adds program change listener to monitor if the program binary
func NewProcCollector ¶
func NewProcCollector(mgr *Manager) *procCollector
NewProcCollector returns new Collector exposing supervisord statistics.
func PathExpand ¶
PathExpand replaces the ~ with user home directory
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manage all the process in the supervisor
func (*Manager) AsyncForEachProcess ¶
AsyncForEachProcess handle each process in async mode Args: - procFunc, the function to handle the process - done, signal the process is completed Returns: number of total processes
func (*Manager) CreateProcess ¶
CreateProcess creates process (program or event listener) and adds to Manager object
func (*Manager) Find ¶
Find process by program name. Returns process or nil if process is not listed in Manager object
func (*Manager) FindMatch ¶
FindMatch lookup program with one of following format: - group:program - group:* - program
func (*Manager) ForEachProcess ¶
ForEachProcess process each process in sync mode
func (*Manager) Remove ¶
Remove process from Manager object
Arguments: name - the name of program
Return the process or nil
func (*Manager) StartAutoStartPrograms ¶
func (pm *Manager) StartAutoStartPrograms()
StartAutoStartPrograms starts all programs that set as should be autostarted
func (*Manager) StopAllProcesses ¶
func (pm *Manager) StopAllProcesses()
StopAllProcesses stop all the processes listed in Manager object
type Process ¶
type Process struct { StdoutLog logger.Logger StderrLog logger.Logger // contains filtered or unexported fields }
Process the program process management data
func NewProcess ¶
NewProcess creates new Process object
func (*Process) GetDescription ¶
GetDescription returns process status description
func (*Process) GetExitstatus ¶
GetExitstatus returns exit status of the process if the program exit
func (*Process) GetPriority ¶
GetPriority returns program priority (as it set in config) with default value of 999
func (*Process) GetStartTime ¶
GetStartTime returns process start time
func (*Process) GetStderrLogfile ¶
GetStderrLogfile returns program stderr log filename
func (*Process) GetStdoutLogfile ¶
GetStdoutLogfile returns program stdout log filename
func (*Process) GetStopTime ¶
GetStopTime returns process stop time
func (*Process) SendProcessStdin ¶
SendProcessStdin sends data to process stdin
func (*Process) Signal ¶
Signal sends signal to the process
Args:
sig - the signal to the process sigChildren - if true, sends the same signal to the process and its children