{
    "content": [
        {
            "type": "text",
            "text": "# runsv(8) (man)\n\n## TLDR\n\n> Start and manage a runit service.\n\n- Start a runit service as the current user:\n  `runsv {{path/to/service}}`\n- Start a runit service as root:\n  `sudo runsv {{path/to/service}}`\n\n*Source: tldr-pages*\n\n---\n\n**Summary:** runsv - starts and monitors a service and optionally an appendant log service\n\n**Synopsis:** runsv service\n\n## See Also\n\n- sv(8)\n- chpst(8)\n- svlogd(8)\n- runit(8)\n- runit-init(8)\n- runsvdir(8)\n- runsvchdir(8)\n- utmpset(8)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (2 lines)\n- **DESCRIPTION** (27 lines)\n- **CONTROL** (44 lines)\n- **CUSTOMIZE CONTROL** (8 lines)\n- **SIGNALS** (3 lines)\n- **EXIT CODES** (4 lines)\n- **SEE ALSO** (4 lines)\n- **AUTHOR** (5 lines)\n\n## Full Content\n\n### NAME\n\nrunsv - starts and monitors a service and optionally an appendant log service\n\n### SYNOPSIS\n\nrunsv service\n\n### DESCRIPTION\n\nservice 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\n### CONTROL\n\nThe 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\n### CUSTOMIZE CONTROL\n\nFor  each  control  character  c sent to the control pipe, runsv first checks if service/con‐\ntrol/c exists and is executable.  If so, it starts service/control/c and waits for it to ter‐\nminate,  before interpreting the command.  If the program exits with return code 0, runsv re‐\nfrains from sending the service the corresponding signal.  The command o is always considered\nas  command  u.  On command d first service/control/t is checked, and then service/control/d.\nOn command x first service/control/t is checked, and then service/control/x.  The control  of\nthe optional log service cannot be customized.\n\n### SIGNALS\n\nIf  runsv  receives  a  TERM signal, it acts as if the character x was written to the control\npipe.\n\n### EXIT CODES\n\nrunsv 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\n### SEE ALSO\n\nsv(8), chpst(8), svlogd(8), runit(8), runit-init(8), runsvdir(8), runsvchdir(8), utmpset(8)\n\nhttp://smarden.org/runit/\n\n### AUTHOR\n\nGerrit Pape <pape@smarden.org>\n\n\n\nrunsv(8)\n\n"
        }
    ],
    "structuredContent": {
        "command": "runsv",
        "section": "8",
        "mode": "man",
        "summary": "runsv - starts and monitors a service and optionally an appendant log service",
        "synopsis": "runsv service",
        "tldr_summary": "Start and manage a runit service.",
        "tldr_examples": [
            {
                "description": "Start a runit service as the current user",
                "command": "runsv {{path/to/service}}"
            },
            {
                "description": "Start a runit service as root",
                "command": "sudo runsv {{path/to/service}}"
            }
        ],
        "tldr_source": "official",
        "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"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 27,
                "subsections": []
            },
            {
                "name": "CONTROL",
                "lines": 44,
                "subsections": []
            },
            {
                "name": "CUSTOMIZE CONTROL",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "SIGNALS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "EXIT CODES",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 5,
                "subsections": []
            }
        ]
    }
}