{
    "content": [
        {
            "type": "text",
            "text": "# runit (man)\n\n## NAME\n\nrunit - a UNIX process no 1\n\n## DESCRIPTION\n\nrunit must be run as Unix process no 1.  It performs the system's booting, running, and shut‐\ndown in three stages:\n\n## TLDR\n\n> 3-stage init system.\n\n- Start runit's 3-stage init scheme:\n  `runit`\n- Shut down runit:\n  `kill --CONT {{runit_pid}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS** (1 subsections)\n- **DESCRIPTION**\n- **STAGE 1**\n- **STAGE 2**\n- **STAGE 3**\n- **CTRL-ALT-DEL**\n- **SIGNALS**\n- **ENVIRONMENT**\n- **SEE ALSO**\n- **AUTHOR**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "runit",
        "section": "",
        "mode": "man",
        "summary": "runit - a UNIX process no 1",
        "synopsis": "",
        "tldr_summary": "3-stage init system.",
        "tldr_examples": [
            {
                "description": "Start runit's 3-stage init scheme",
                "command": "runit"
            },
            {
                "description": "Shut down runit",
                "command": "kill --CONT {{runit_pid}}"
            }
        ],
        "tldr_source": "official",
        "flags": [],
        "examples": [],
        "see_also": [
            {
                "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": "sv",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/sv/8/json"
            },
            {
                "name": "runsv",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/runsv/8/json"
            },
            {
                "name": "chpst",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/chpst/8/json"
            },
            {
                "name": "utmpset",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/utmpset/8/json"
            },
            {
                "name": "svlogd",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/svlogd/8/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "runit",
                        "lines": 1
                    }
                ]
            },
            {
                "name": "DESCRIPTION",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "STAGE 1",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "STAGE 2",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "STAGE 3",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "CTRL-ALT-DEL",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "SIGNALS",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "ENVIRONMENT",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "runit - a UNIX process no 1\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "",
                "subsections": [
                    {
                        "name": "runit",
                        "content": ""
                    }
                ]
            },
            "DESCRIPTION": {
                "content": "runit must be run as Unix process no 1.  It performs the system's booting, running, and shut‐\ndown in three stages:\n",
                "subsections": []
            },
            "STAGE 1": {
                "content": "runit runs /etc/runit/1 and waits for it to terminate.  The system's one time tasks are  done\nhere.   /etc/runit/1  has full control of /dev/console to be able to start an emergency shell\nif the one time initialization tasks fail. If /etc/runit/1 crashes, or exits 100, runit  will\nskip stage 2 and enter stage 3.\n",
                "subsections": []
            },
            "STAGE 2": {
                "content": "runit runs /etc/runit/2, which should not return until system shutdown; if it crashes, or ex‐\nits 111, it will be restarted.  Normally /etc/runit/2 starts runsvdir(8).  runit is  able  to\nhandle the ctrl-alt-del keyboard request in stage 2, see below.\n",
                "subsections": []
            },
            "STAGE 3": {
                "content": "If  runit  is told to shutdown the system, or stage 2 returns, it terminates stage 2 if it is\nrunning, and runs /etc/runit/3.  The systems tasks to shutdown and possibly  halt  or  reboot\nthe system are done here.  If stage 3 returns, runit checks if the file /run/runit.reboot ex‐\nists and has the execute by owner permission set.  If so, the system is rebooted, it's halted\notherwise.   If  /etc/runit/nosync  exists,  runit  doesn't  invoke sync(). This is useful in\nvservers.\n",
                "subsections": []
            },
            "CTRL-ALT-DEL": {
                "content": "If runit receives the ctrl-alt-del keyboard request and the file /etc/runit/ctrlaltdel exists\nand  has  the execute by owner permission set, runit runs /etc/runit/ctrlaltdel, waits for it\nto terminate, and then sends itself a CONT signal.\n",
                "subsections": []
            },
            "SIGNALS": {
                "content": "runit only accepts signals in stage 2.\n\nIf runit receives a CONT signal and the file /run/runit.stopit exists and has the execute  by\nowner permission set, runit is told to shutdown the system.\n\nIf runit receives a PWR signal, runit is told to shutdown the system.\n\nif runit receives an INT signal, a ctrl-alt-del keyboard request is triggered.\n",
                "subsections": []
            },
            "ENVIRONMENT": {
                "content": "When  the  runitdir=name  variable  is set and runit is init, runit will check if a directory\nnamed name exists in /etc/runit/runsvdir/ and then will use runsvchdir to change  the  direc‐\ntory of runsvdir to name in place of the default.\n\nIf  runitdir  is  set  to runitdir=solo runit will use the solo directory for runsvdir and it\nwill also refrain from start any sysv service that is enabled in /etc/rc2.d/ This is intended\nfor use with containers that need to start only some selected services.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "runit-init(8), runsvdir(8), runsvchdir(8), sv(8), runsv(8), chpst(8), utmpset(8), svlogd(8)\n\nhttp://smarden.org/runit/\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Gerrit Pape <pape@smarden.org>\n\n\n\nrunit(8)",
                "subsections": []
            }
        }
    }
}