Documentation
¶
Index ¶
Constants ¶
View Source
const ( ProcessRunningCode = iota ProcessStoppedCode ProcessDeadCode )
Variables ¶
View Source
var ( ProcStateRunning = ProcessState{ Code: ProcessRunningCode, ColorSprint: color.New(color.FgGreen).SprintFunc(), Status: "RUNNING"} ProcStateStopped = ProcessState{ Code: ProcessStoppedCode, ColorSprint: color.New(color.FgYellow).SprintFunc(), Status: "NOT RUNNING"} ProcStateDead = ProcessState{ Code: ProcessDeadCode, ColorSprint: color.New(color.FgRed).SprintFunc(), Status: "ERROR. The process is dead"} )
Functions ¶
func CheckPIDFile ¶
CheckPIDFile checks that the process PID file exists and is readable. Or process is already exist. Removes PID file if process is dead.
func CreatePIDFile ¶
CreatePIDFile checks that the instance PID file is absent or deprecated and creates a new one. Returns an error on failure.
func GetPIDFromFile ¶
GetPIDFromFile returns PID from the PIDFile.
func IsProcessAlive ¶
IsProcessAlive checks if the process is alive.
func StopProcess ¶
StopProcess stops the process by pidFile.
Types ¶
type ProcessState ¶ added in v0.4.0
type ProcessState struct { Code int ColorSprint func(a ...interface{}) string Status string PID int }
func ProcessStatus ¶
func ProcessStatus(pidFile string) ProcessState
ProcessStatus returns the status of the process.
func (ProcessState) String ¶ added in v1.1.1
func (procState ProcessState) String() string
String makes a string from ProcessState.
Click to show internal directories.
Click to hide internal directories.