runit
Manage and supervise processes
TLDR
Start runit's 3-stage init scheme
Shut down runit
SYNOPSIS
runsvdir dir
runsv dir
sv command service_directory
chpst [options] command [args]
PARAMETERS
runsvdir dir
Starts the service supervision process for all service directories under dir.
runsv dir
Starts the supervision of a single service directory dir.
sv command service_directory
Sends a command to the service in service_directory. Common commands include 'start', 'stop', 'restart', 'status', 'force-stop', 'force-restart'.
chpst [options] command [args]
Runs command with modified process state. This can be used to change the user, group, nice level, resource limits, and more of a process being run by runit.
DESCRIPTION
runit is a suite of tools for service management in Unix-like operating systems. It provides a reliable and lightweight alternative to traditional init systems like System V init or systemd. The core principle of runit is to keep services up and running. It includes a supervisor process (runsvdir) that monitors services within a directory, automatically restarting them if they fail. Each service is managed by a simple script named 'run' inside its service directory. Logging is handled directly by runit, using runsvlog to efficiently capture and archive service output.
One of the main design goals is simplicity and reliability. Services are managed in a clear and predictable way, which can make it easier to manage dependencies. runit supports smooth transitions on shutdown, guaranteeing a clean service shutdown and prevents data corruption. The run script can contain complex procedures for setting the environment. runit is well-suited for embedded systems, containers, and other environments where a minimal footprint and resource usage are desired.
CAVEATS
runit requires careful setup and configuration. Improperly written 'run' scripts can lead to unexpected behavior or service failures. Understanding signal handling and process lifecycle is crucial for effective use. When managing the services the user needs to have proper rights on the service directories to run the *sv* command.
<B>SERVICE STATES</B>
runit defines several states for managed services, including 'up', 'down', 'starting', 'stopping', and 'once'. Understanding these states is important for troubleshooting.
<B>LOGGING</B>
runit's logging system, runsvlog, is designed to be efficient and reliable. It can rotate logs, compress them, and manage disk space usage. Proper configuration of runsvlog is important to avoid disk space exhaustion.
HISTORY
runit was created by Gerrit Pape as a lightweight and reliable init system alternative. It was designed to address perceived shortcomings of traditional init systems. runit has been available since the early 2000s and it has become a popular choice for managing services in systems where simplicity and resource efficiency are important. It gained traction within the containerization community, as it provides a simple and robust solution for process supervision within containers.