Documentation
¶
Index ¶
Constants ¶
const PluginName string = "coprocess"
PluginName contains the name/id of the plugin.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(name string, exec []string, stopExec []string, user string, restarts string, background bool, execEvent string, stopEvent string, settings api.Settings) (Coprocess, *InitError)
New creates a new instance of Coprocess and validates that the passed parameters are valid.
func Start ¶
func Start(context api.PluginStartupContext) error
Start is invoked by nginx-wrapper to start the plugin.
Types ¶
type Coprocess ¶
type Coprocess struct { Name string Exec []string StopExec []string User string Restarts RestartPolicy Background bool ExecEvent string StopEvent string Done *abool.AtomicBool // contains filtered or unexported fields }
Coprocess represents a process that will run alongside nginx and be tied to a nginx start event and stop event.
func (*Coprocess) ExecuteCoprocess ¶
ExecuteCoprocess invokes the associated process and optionally runs it repeatedly according to the associated restart policy.
func (*Coprocess) ExecuteStopCmd ¶
ExecuteStopCmd executes the optional command associated with the coprocess to run when the stop event is encountered.
func (*Coprocess) MaxRestarts ¶
MaxRestarts returns the maximum number of restarts for the associated process with -1 indicating an unlimited amount of restarts.
func (*Coprocess) TerminateCoprocess ¶
TerminateCoprocess terminates the associated coprocess by sending (in this order) SIGTERM, SIGINT, or SIGKILL until the process exits.
type RestartPolicy ¶
type RestartPolicy string
RestartPolicy represents what we do when a process has stopped. Valid values are defined in the constants below or alternatively an integer value represented as a string.
const ( // Unlimited restart policy means that the process will always be restarted if it exits. Unlimited RestartPolicy = "unlimited" // Never restart policy means that the process will never be restarted if it exits. Never RestartPolicy = "never" )