runsv

Supervise a single runit service process

TLDR

Supervise a service
$ runsv [/etc/service/myservice]
Check service status
$ sv status [myservice]
Send signal
$ sv signal [myservice]

SYNOPSIS

runsv servicedir

DESCRIPTION

runsv supervises a single service. It runs and monitors the service defined in the directory.The run script is executed and monitored. If it exits, runsv restarts it.Optional finish script runs after service exits. Cleanup operations go here.Optional log directory runs a logging service. Captures stdout/stderr.Control interface via supervise directory. The sv command communicates here.

SERVICE DIRECTORY

run - Executable service script (required)finish - Cleanup script (optional)log/run - Logger service (optional)supervise/ - Created by runsv for control

CONTROL COMMANDS

Written to service/supervise/control (typically via sv):u - Up; start service and restart if it stopsd - Down; send TERM+CONT and don't restarto - Once; start but don't restart on exitp - Pause (SIGSTOP)c - Continue (SIGCONT)h - Hangup (SIGHUP)a - Alarm (SIGALRM)i - Interrupt (SIGINT)q - Quit (SIGQUIT)1 - SIGUSR12 - SIGUSR2t - Terminate (SIGTERM)k - Kill (SIGKILL)x - Exit runsv and close log pipes

INSTALL

sudo apt install runit
sudo apk add runit
brew install runit
nix profile install nixpkgs#runit

CAVEATS

Usually run by runsvdir, not directly. Service directory must have correct permissions and an executable run script. A down file in the service directory prevents automatic startup. Exits with status 111 on startup errors or if another runsv is already supervising the same directory.

HISTORY

runsv is part of runit by Gerrit Pape. It provides the core supervision functionality for individual services.

SEE ALSO

runit(8), sv(8), runsvdir(8), svlogd(8), chpst(8)