Runit Explained

runit
Author:Gerrit Pape
Released:[1]
Latest Release Version:2.1.2
Latest Release Date:[2]
Programming Language:C, Shell
Operating System:Linux, FreeBSD, OpenBSD, NetBSD, macOS, Solaris
Genre:Init daemon
License:New BSD License

runit is an init and service management scheme for Unix-like operating systems that initializes, supervises, and ends processes throughout the operating system. Runit is a reimplementation of the daemontools[3] process supervision toolkit that runs on many Linux-based operating systems, as well as BSD, and Solaris operating systems. Runit features parallelization of the start up of system services, which can speed up the boot time of the operating system.[4]

When running as an init daemon, Runit is the direct or indirect ancestor of all other processes. It is the first process started during booting, and continues running until the system is shut down. It is often used with other init systems as a separate service manager. In the service manager role, it can be used by unprivileged users to orchestrate personal services, as well as by root to manage services not otherwise managed by the init system currently in use.

Design

Runit focuses on being a small, modular, and portable codebase. In the init role, Runit is split into three stages: one time initialization, process supervision, and halting or rebooting. While the first and third stages must be adapted to the specific operating system they are running on, the second stage is portable across all POSIX compliant operating systems.[5] The 3 stages can be configured through 3 executable files (they are usually shell scripts) named, respectively, 1, 2, and 3.

Stage 2 usually invokes a binary named runsvdir, which is the process responsible for global daemon management: for every daemon it finds in a folder passed to it by argument, it then spawns an individual watchdog, each of those starts a daemon (and a logger service eventually associated to it) and restarts it if it dies. In case a daemon is added or removed, it kills the watchdog or starts a new one.Executable files with specific names are used to describe the various phases of the daemon's life (run, check, finish, ...), it can intercept signals sent and run by specific scripts if they exist, and named pipes are created to expose interfaces to control the daemon.

Usage

Runit can be used either as a drop-in replacement[6] for sysvinit, or as a service supervisor (with sysvinit as the parent PID 1 process which runs processes specified by the inittab file, or some other init system).[7] The RubyWorks stack of software able to run Ruby on Rails incorporated Runit into its suite.[8]

Adoption

Runit is the default init system of:

Runit is an "officially" available init system for:

External links

Notes and References

  1. runit-1.0.0 release . 2004-02-10 . 2013-12-10 . gmane.comp.sysutils.supervision.general . Pape . Gerrit . 2013-12-13 . https://web.archive.org/web/20131213132803/http://permalink.gmane.org/gmane.comp.sysutils.supervision.general/308 . dead .
  2. Web site: runit - installation . Pape . Gerrit . 2009-10-04 . smarden.org . 2014-08-10.
  3. Web site: Init Scripts Considered Harmful . Purcell . Steve . 2007-11-11 . sanityinc.com . 12 December 2013.
  4. Web site: Pape. Gerrit. runit - benefits. 23 April 2013.
  5. Web site: Pape. Gerrit. runit - benefits. 23 April 2013.
  6. Web site: Pape. Gerrit. replacing init. 11 August 2014.
  7. Web site: Pape. Gerrit. use with traditional init. 11 August 2014.
  8. Web site: Process management with runit . . rubyworks.rubyforge.org . 14 April 2014.
  9. Web site: VoidLinux. 28 June 2020.
  10. Web site: Gentoo. 28 April 2024.