Simple process manager library.
The useful methods are:
NewOverseer()
- Returns a new instance of a process manager.- To register processes, use the
Add(id string, args ...string)
method, and to unregister use theRemove(id string)
method. SuperviseAll()
- This is the main function. Supervise all processes and block until they finish. This includes killing all the processes when the main program exits.Supervise(id string)
- Supervise one registered process and block until it finishes. This includes checking if the process was killed from the outside, delaying the start and restarting in case of failure.Stop(id string)
- Stops the process by sending its process group a SIGTERM signal.Signal(id string, sig syscall.Signal)
- Sends an OS signal to the process group.StopAll()
- Cycles and stops all processes by sending SIGTERM.
Highlights:
- real-time stdout and stderr
- real-time status
- complete and consolidated return
- proper process termination on exit
- portable command line binary for managing procs
- heavily tested, good coverage
- no race conditions
For examples of usage, please check the tests, or the command line script (for now). The API is not fixed yet.
- https://github.com/go-cmd/cmd - os/exec.Cmd with concurrent-safe access, real-time streaming output and complete runtime/return status. Overseer is based off this one.
- https://github.com/immortal/immortal - A *nix cross-platform (OS agnostic) supervisor. The real deal.
- https://github.com/ochinchina/supervisord - A Golang supervisor implementation, inspired by Python supervisord.
Icon is made by Freepik from www.flaticon.com and licensed by CC 3.0 BY.
MIT © Cristi Constantin.