{
    "mode": "man",
    "parameter": "runsv",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/runsv/8/json",
    "generated": "2026-08-28T03:54:49Z",
    "synopsis": "runsv service",
    "sections": {
        "NAME": {
            "content": "runsv - starts and monitors a service and optionally an appendant log service\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "runsv service\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "service must be a directory.\n\nrunsv  switches  to  the directory service and starts ./run.  If ./run exits and ./finish ex‐\nists, runsv starts ./finish.  If ./finish doesn't exist or  ./finish  exits,  runsv  restarts\n./run.\n\nIf  ./run  or  ./finish  exit  immediately,  runsv waits a second before starting ./finish or\nrestarting ./run.\n\nTwo arguments are given to ./finish.  The first one is ./run's exit  code,  or  -1  if  ./run\ndidn't exit normally.  The second one is the least significant byte of the exit status as de‐\ntermined  by waitpid(2); for instance it is 0 if ./run exited normally, and the signal number\nif ./run was terminated by a signal.  If runsv cannot start ./run for some reason,  the  exit\ncode is 111 and the status is 0.\n\nIf  the file service/down exists, runsv does not start ./run immediately.  The control inter‐\nface (see below) can be used to start the service and to give other commands to runsv.\n\nIf the directory service/log exists, runsv creates a pipe, redirects service/run's  and  ser‐\nvice/finish's  standard  output to the pipe, switches to the directory service/log and starts\n./run script. The standard input of the log service is redirected to read from the pipe.\n\nrunsv maintains status information in a binary format (compatible to the daemontools'  super‐\nvise  program)  in service/supervise/status and service/log/supervise/status, and in a human-\nreadable format in service/supervise/stat, service/log/supervise/stat, service/supervise/pid,\nservice/log/supervise/pid.\n",
            "subsections": []
        },
        "CONTROL": {
            "content": "The named pipes service/supervise/control, and (optionally) service/log/supervise/control are\nprovided to give commands to runsv.  You can use sv(8) to control the service or  just  write\none of the following characters to the named pipe:\n\nu      Up.  If the service is not running, start it.  If the service stops, restart it.\n\nd      Down.   If  the service is running, send it a TERM signal, and then a CONT signal.  If\n./run exits, start ./finish if it exists.  After it stops, do not restart service.\n\no      Once.  If the service is not running, start it.  Do not restart it if it stops.\n\np      Pause.  If the service is running, send it a STOP signal.\n\nc      Continue.  If the service is running, send it a CONT signal.\n\nh      Hangup.  If the service is running, send it a HUP signal.\n\na      Alarm.  If the service is running, send it a ALRM signal.\n\ni      Interrupt.  If the service is running, send it a INT signal.\n\nq      Quit.  If the service is running, send it a QUIT signal.\n\n1      User-defined 1.  If the service is running, send it a USR1 signal.\n\n2      User-defined 2.  If the service is running, send it a USR2 signal.\n\nt      Terminate.  If the service is running, send it a TERM signal.\n\nk      Kill.  If the service is running, send it a KILL signal.\n\nx      Exit.  If the service is running, send it a TERM signal, and then a CONT  signal.   Do\nnot restart the service.  If the service is down, and no log service exists, runsv ex‐\nits.  If the service is down and a log service exists, runsv closes the standard input\nof  the log service, and waits for it to terminate.  If the log service is down, runsv\nexits.  This command is ignored if it is given to service/log/supervise/control.\n\nExample: to send a TERM signal to the socklog-unix service, either do\n# sv term /etc/service/socklog-unix\nor\n# printf t >/etc/service/socklog-unix/supervise/control\n\nprintf(1) usually blocks if no runsv process is running in the service directory.\n",
            "subsections": []
        },
        "CUSTOMIZE CONTROL": {
            "content": "For each control character c except \"d\" and \"x\" sent to the control pipe, runsv first  checks\nif  service/control/c exists and is executable.  If so, it starts service/control/c and waits\nfor it to terminate, before interpreting the command.  If the program exits with return  code\n0, runsv refrains from sending the service the corresponding signal.  The command o is always\nconsidered  as  command  u.   On  command d first service/control/t is checked, and then ser‐\nvice/control/d.  On command x first service/control/t is checked, and then service/control/x.\nSpecifically:\n\nIf the service is running or paused, control characters \"d\" and \"x\" are handled as follows:\n\n1.     runsv checks whether service/control/t exists and is executable and runs it if yes.\n\n2.     If service/control/t exits nonzero, or is not executable or doesn't exist, runsv sends\nthe service a TERM signal.\n\n3.     runsv sends the service a CONT signal, disregarding service/control/c even if  it  ex‐\nists and is executable.\n\n4.     runsv  checks  whether  service/control/d  (or control/x) exists and is executable and\nruns it if yes. Its exit status is ignored.\n\nThe control of the optional log service cannot be customized.\n",
            "subsections": []
        },
        "SIGNALS": {
            "content": "If runsv receives a TERM signal, it acts as if the character x was  written  to  the  control\npipe.\n",
            "subsections": []
        },
        "EXIT CODES": {
            "content": "runsv exits 111 on an error on startup or if another runsv is running in service.\n\nrunsv exits 0 if it was told to exit.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "sv(8), chpst(8), svlogd(8), runit(8), runit-init(8), runsvdir(8), runsvchdir(8), utmpset(8)\n\nhttp://smarden.org/runit/\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Gerrit Pape <pape@smarden.org>\n\nrunsv(8)",
            "subsections": []
        }
    },
    "summary": "runsv - starts and monitors a service and optionally an appendant log service",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "sv",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/sv/8/json"
        },
        {
            "name": "chpst",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/chpst/8/json"
        },
        {
            "name": "svlogd",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/svlogd/8/json"
        },
        {
            "name": "runit",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/runit/8/json"
        },
        {
            "name": "runit-init",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/runit-init/8/json"
        },
        {
            "name": "runsvdir",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/runsvdir/8/json"
        },
        {
            "name": "runsvchdir",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/runsvchdir/8/json"
        },
        {
            "name": "utmpset",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/utmpset/8/json"
        }
    ]
}