runit on antiX-bullseye iso.

Forum Forums General Tips and Tricks runit on antiX-bullseye iso.

  • This topic has 0 replies, 1 voice, and was last updated Mar 26-7:00 pm by anticapitalista.
Viewing 1 post (of 1 total)
  • Author
  • #56414
    Forum Admin

    This is a work in progress.

    Much of the information has been copied from Artix wiki on runit, but modified to how it runs on antiX.

    What is runit?
    runit is a suite of tools which provides an init (PID 1) as well as daemontools-compatible process supervision framework, along with utilites which streamline creation and maintenance of services.

    This is very much a work in progress. If users want to try out runit, use the runit version iso. Otherwise, converting an existing antiX-sysvinit to runit will probably end in breakage.

    Installation of services
    A basic set of runit service packages are provided on the iso and can be found in /etc/sv

    runit has several programs, but usually you will only interact directly with one program only.

    *sv – used for controlling services, getting status of services, and dependency checking.
    *chpst – control of a process environment, including memory caps, limits on cores, data segments, environments, user/group privileges, and more.
    *runsv – supervises a process, and optionally a log service for that process.
    *svlogd – a simple but powerful logger, includes auto-rotation based on different methods (time, size, etc), post-processing, pattern matching, and socket (remote logging) options.
    *runsvchdir – changes service levels (runlevels, see below)
    *runsvdir – starts a supervision tree
    *runit-init – PID 1, does almost nothing besides being the init

    There are several files installed by runit.

    /etc/runit/1 – stage 1, system’s one-time initialization tasks
    /etc/runit/2 – stage 2, Normally runs runsvdir, should not return until the system is going to halt or reboot.
    /etc/runit/3 – stage 3, system’s shutdown tasks
    /etc/runit/ctrlaltdel – runit will execute this when receiving a SIGINT signal
    /etc/runit/runsvdir/* – Runlevels
    /etc/sv/* – directory containing subdirectories of available service files
    /etc/service – always symlinked to active runlevel, sv will search for running service here

    On antiX, one-time initialization task scripts are mostly found in /etc/runit-core and a few in /etc/init.d
    antiX has altered Debian’s sysvinit scripts to run as runit scripts.

    Basic usage

    *Enable service (in runlevel default)# ln -s /etc/sv/service_name /etc/service/
    *Disable service # unlink /etc/service/service_name or # touch down /etc/sv/service_name
    *Stop immediately # sv down service_name or # sv stop service_name
    *Start (if not running) # sv up service_name or # sv restart service_name
    *Restart # sv restart service_name
    *Reload # sv restart service_name
    *Status check # sv status service_name
    *Switch runlevels (this will stop all services that are currently running and will start all services in the new runlevel) # runsvchdir runlevel

    By default, on antiX runit has 3 runlevels, default, single and solo. You can make your own runlevels just by creating a new folder in /etc/runit/runsvdir/ and symlinking your desired service to that runlevel.

    Service directory structure
    This is a tree of a complete service directory structure (aka /etc/sv/servicedir), in some run scripts, typically only run will be available as usually it’s the only file needed.

    ├── run (755)
    ├── check (755)
    ├── conf (644)
    ├── finish (755)
    └── log (directory)
    ├── config (644)
    └── run (755)

    A runit (or any daemontools-compatible) run script service directory usually contains only one executable file, run, which runs process in the foreground. Processes that run in the background cannot be supervised by runit.

    If a service directory contains another directory named log, the output of the run process in the service directory will be piped to the input of the run process in the log directory. If the log service uses svlogd, it may be configured by using the file config. How svlogd can be configured is explained in the svlogd(1) manpage.

    A run script may also contain executables like finish and check. finish will be executed when a service is stopped, and check will be executed (if exists) by sv check or sv status.

    A run script may also contain a conf file (which is not executable) that modifies the variables available to the script.

    Service dependencies
    Some services may depend on other services. For example, NetworkManager depends on dbus. To ensure that required dependencies are satisfied, check the service’s run file. For example, for NetworkManager:

    # /etc/sv/NetworkManager/run
    sv check dbus >/dev/null || exit 1

    This means you have to enable dbus for NetworkManager to start.

    Philosophers have interpreted the world in many ways; the point is to change it.

    antiX with runit - leaner and meaner.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.