Documentation ¶
Index ¶
- type Proc
- func (proc *Proc) AddRestart()
- func (proc *Proc) Delete() error
- func (proc *Proc) ForceStop() error
- func (proc *Proc) GetPid() int
- func (proc *Proc) GetStatus() *ProcStatus
- func (proc *Proc) GracefullyStop() error
- func (proc *Proc) Identifier() string
- func (proc *Proc) IsAlive() bool
- func (proc *Proc) NotifyStopped()
- func (proc *Proc) Restart() error
- func (proc *Proc) SetStatus(status string)
- func (proc *Proc) ShouldKeepAlive() bool
- func (proc *Proc) Start() error
- func (proc *Proc) Watch() (*os.ProcessState, error)
- type ProcContainer
- type ProcStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Proc ¶
type Proc struct { Name string Cmd string Args []string Path string Pidfile string Outfile string Errfile string KeepAlive bool Pid int Status *ProcStatus // contains filtered or unexported fields }
Proc is a os.Process wrapper with Status and more info that will be used on Master to maintain the process health.
func (*Proc) Delete ¶
Delete will delete everything created by this process, including the out, err and pid file. Returns an error in case there's any.
func (*Proc) ForceStop ¶
ForceStop will forcefully send a SIGKILL signal to process killing it instantly. Returns an error in case there's any.
func (*Proc) GracefullyStop ¶
GracefullyStop will send a SIGTERM signal asking the process to terminate. The process may choose to die gracefully or ignore this signal completely. In that case the process will keep running unless you call ForceStop() Returns an error in case there's any.
func (*Proc) Identifier ¶
Proc identifier that will be used by watcher to keep track of its processes
func (*Proc) IsAlive ¶
IsAlive will check if the process is alive or not. Returns true if the process is alive or false otherwise.
func (*Proc) NotifyStopped ¶
func (proc *Proc) NotifyStopped()
Notify that process was stopped so we can set its PID to -1
func (*Proc) Restart ¶
Restart will try to gracefully stop the process and then Start it again. Returns an error in case there's any.
func (*Proc) ShouldKeepAlive ¶
Returns true if the process should be kept alive or not
type ProcContainer ¶
type ProcContainer interface { Start() error ForceStop() error GracefullyStop() error Restart() error Delete() error IsAlive() bool Identifier() string ShouldKeepAlive() bool AddRestart() NotifyStopped() SetStatus(status string) GetPid() int GetStatus() *ProcStatus Watch() (*os.ProcessState, error) // contains filtered or unexported methods }
type ProcStatus ¶
ProcStatus is a wrapper with the process current status.
func (*ProcStatus) AddRestart ¶
func (proc_status *ProcStatus) AddRestart()
AddRestart will add one restart to the process status.
func (*ProcStatus) SetStatus ¶
func (proc_status *ProcStatus) SetStatus(status string)
SetStatus will set the process string status.