Documentation
¶
Index ¶
Constants ¶
View Source
const ( ProcessRunningCode = iota ProcessStoppedCode ProcessDeadCode )
Variables ¶
View Source
var ( ProcStateRunning = ProcessState{ ProcessRunningCode, color.New(color.FgGreen).SprintFunc(), "RUNNING. PID: %v."} ProcStateStopped = ProcessState{ProcessStoppedCode, color.New(color.FgYellow).SprintFunc(), "NOT RUNNING"} ProcStateDead = ProcessState{ProcessDeadCode, color.New(color.FgRed).SprintFunc(), "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
func ProcessStatus ¶
func ProcessStatus(pidFile string) ProcessState
ProcessStatus returns the status of the process.
Click to show internal directories.
Click to hide internal directories.