Setting up a Functional runit Service
What is runit?
I came across runit a few years ago and I was really amazed how clean it was to set up a process and how effective this service supervision scheme was. It is based on a directory structure and once you get a hang of it, it is easy to set up services using the runit scheme.
According to the official documentation, “runit is a cross-platform Unix init scheme with service supervision, a replacement for sysvinit, and other init schemes”. This is what it means in layman terms:
- Automatic start of service after the system boots up
- Automatic restart and continuous monitoring of a service if it is terminated
Pre-requisites:
runit package: Make sure the package is installed on your system, by running the command.
dpkg -l | grep runit
If the output is empty, it implies that the package isn’t available and can be installed with the command below
apt-get install runit
Main Components of runit:
- runsv
- runsvdir
- sv
runsv: It starts and monitors the service (and optionally the log service associated with the service if…