Documentation
¶
Index ¶
- Constants
- type Instance
- func (i *Instance) ChangeStatus(state int)
- func (i *Instance) CreateJob() error
- func (i *Instance) GetStatus() string
- func (i *Instance) PIDExists() bool
- func (i *Instance) Run(callback func())
- func (i *Instance) StartInstance(wait bool)
- func (i *Instance) StopInstance(wait bool)
- func (i *Instance) String() string
- func (i *Instance) WaitForExit()
Constants ¶
const ( /* * PROCSTOPPED signifies process not currently running */ PROCSTOPPED = iota /* * PROCRUNNING signifies process currently running */ PROCRUNNING /* * PROCSTART signifies process beginning its start sequence */ PROCSTART /* * PROCEXITED signifies process has ended */ PROCEXITED /* * PROCBACKOFF signifies should not alter process */ PROCBACKOFF /* * PROCSTOPPING signifies in process of stopping */ PROCSTOPPING /* * PROCSTARTFAIL signifies process could not start successfully */ PROCSTARTFAIL )
const ( /* * RESTARTALWAYS signifies restart whenever process is stopped */ RESTARTALWAYS = iota /* * RESTARTNEVER signifies never restart process */ RESTARTNEVER /* * RESTARTUNEXPECTED signifies restart on unexpected exit */ RESTARTUNEXPECTED )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Instance ¶
type Instance struct {
JobID int
InstanceID int
Args []string
RestartPolicy int
ExpectedExit int
StartCheckup int
Restarts *int32
MaxRestarts int32
StopSignal os.Signal
StopTimeout int
EnvVars []string
WorkingDir string
Umask int
StartTime time.Time
StopTime time.Time
Status int
Redirections []*os.File
Stopped bool
Process *os.Process
Mutex sync.RWMutex
Condition *sync.Cond
State *os.ProcessState
Cfg *CFG.JobConfig
Starting bool
FinishedCh chan struct{}
}
* Instance struct manages the execution of one process
func (*Instance) ChangeStatus ¶
* ChangeStatus sets State
func (*Instance) Run ¶
func (i *Instance) Run(callback func())
* Run launches the process and monitors the start, restarting if start has * failed on successful start, waits for process to complete and sends a * Finished message on FinishedCh
func (*Instance) StartInstance ¶
* StartInstance manages the execution of a process by launching a process by * calling instance.Run() and rerunning the process after exit if * restartPolicy == always or restartPolicy == unexpected AND the exit code does * not match the exit code specified in the config
func (*Instance) StopInstance ¶
* StopInstance is used to stop the process by sending the specified stop signal * or the SIGKILL signal if the stop signal is not received
func (*Instance) WaitForExit ¶
func (i *Instance) WaitForExit()
* WaitForExit waits for os.Process exit and saves returned ProcessState