go get github.com/codemodify/systemkit-processes
find.ProcessByPID(pid) | Find process by PID |
find.AllProcesses() | Fetches a snapshot of all running processes |
procMon := monitor.New() |
Create a new process monitor |
procMon.Spawn (template) |
Spawns and monitors a process based on a template, generates a tag |
procMon.SpawnWithTag (template, tag) |
Spawns and monitors a process based on a template and custom tag |
procMon.Start (tag) |
Starts the process taged with ID |
procMon.Stop (tag) |
Stop the process taged with ID |
procMon.Restart (tag) |
Restart the process taged with ID |
procMon.StopAl l() |
Stops all monitored processes |
procMon.GetProcess (tag) |
Gets the running process |
procMon.RemoveFromMonitor (tag) |
Removes a process from being monitred |
procMon.GetAllTags () |
Returns tags for all monitored processes |
proc.Start () |
Starts the process |
proc.Stop () |
Stops the process (kills it if needed) |
proc.IsRunning () |
true if process is running |
proc.Details () |
Details about the process, like PID, executable name |
proc.ExitCode () |
Returns the exit code |
proc.StartedAt () |
Started time |
proc.StoppedAt () |
Stopped time |
proc.OnStdOut
() | Set reader for process STDOUT
proc.OnStdErr
() | Set reader for process STDERR
proc.OnStop
() | Set handler when the process stops