Supervisor

Manage your processes better!

Supervisor is a utility for managing any number of other processes. It starts, stops, restarts, and can perform a certain amount of inspection into the processes it manages.

Why not just use the system's init?

Supervisor isn't a replacement for your system's init—it is designed to be a controller for a subset of processes, not the controller for all processes. Supervisor can be thought of more as a watchdog process. It starts and then keeps an eye on sub processes that are defined in its configuration. When a subprocess's state changes, Supervisor can restart the process, send out a notification, or perform other tasks (depending on the plugins that are active).

Getting back to the question, why not just use system's init? Well, because of this watchdog behavior! Normal behavior for an init system is to simply start processes, and maybe try to control it through use of PID files. This behavior is prone to all sorts of disconnects, and tends not to be reliable. In a more traditional init system, each separate process will need its own configuration, or the configuration will necessarily be a complex set of scripts to manage the processes together.

Supervisor really shines when a lot of processes in a system need to be coordinated. It provides a standard interface to managing those processes and exposes a way to monitor those processes collectively.

Supervisor has some very compelling features:

  • Groups of processes can be defined, and then any operation able to be performed on a single process can be performed on a group of processes
  • Very simple configuration. All configuration is done through key-value pairs in a standard ini-style configuration file—it is not really a domain specific language (DSL), and does not require a script to be executed with elevated permissions
  • Status of managed processes is more accurately known, which paves the way for being able to reap a process based on memory consumption (and other factors)
  • Delegation of control—in other words, Supervisor itself can be given elevated permissions to manage several processes, but then reduced permissions can be given to individual users in order for them to manage specific processes

To get started using Supervisor, take a look at the project's documentation. it is high quality with plenty of examples!