{
    "content": [
        {
            "type": "text",
            "text": "# sv (man)\n\n## NAME\n\nsv - control and manage services monitored by runsv(8)\n\n## SYNOPSIS\n\nsv [-v] [-w sec] command services\n/etc/init.d/service [-w sec] command\n\n## DESCRIPTION\n\nThe sv program reports the current status and controls the state of services monitored by the\nrunsv(8) supervisor.\n\n## TLDR\n\n> Control a running runsv service.\n\n- Start a service:\n  `sudo sv up {{path/to/service}}`\n- Stop a service:\n  `sudo sv down {{path/to/service}}`\n- Get service status:\n  `sudo sv status {{path/to/service}}`\n- Reload a service:\n  `sudo sv reload {{path/to/service}}`\n- Start a service, but only if it's not running and don't restart it if it stops:\n  `sudo sv once {{path/to/service}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **COMMANDS** (10 subsections)\n- **OPTIONS** (2 subsections)\n- **ENVIRONMENT**\n- **EXIT CODES**\n- **SEE ALSO**\n- **AUTHOR**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "sv",
        "section": "",
        "mode": "man",
        "summary": "sv - control and manage services monitored by runsv(8)",
        "synopsis": "sv [-v] [-w sec] command services\n/etc/init.d/service [-w sec] command",
        "tldr_summary": "Control a running runsv service.",
        "tldr_examples": [
            {
                "description": "Start a service",
                "command": "sudo sv up {{path/to/service}}"
            },
            {
                "description": "Stop a service",
                "command": "sudo sv down {{path/to/service}}"
            },
            {
                "description": "Get service status",
                "command": "sudo sv status {{path/to/service}}"
            },
            {
                "description": "Reload a service",
                "command": "sudo sv reload {{path/to/service}}"
            },
            {
                "description": "Start a service, but only if it's not running and don't restart it if it stops",
                "command": "sudo sv once {{path/to/service}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-v",
                "long": null,
                "arg": null,
                "description": "the command to take effect. Then report the status or timeout."
            },
            {
                "flag": "-w",
                "long": null,
                "arg": null,
                "description": ""
            }
        ],
        "examples": [],
        "see_also": [
            {
                "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": "svlogd",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/svlogd/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": "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"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 15,
                "subsections": []
            },
            {
                "name": "COMMANDS",
                "lines": 10,
                "subsections": [
                    {
                        "name": "pause cont hup alarm interrupt quit 1 2 term kill",
                        "lines": 11
                    },
                    {
                        "name": "Commands compatible to LSB init script actions",
                        "lines": 12
                    },
                    {
                        "name": "restart",
                        "lines": 5
                    },
                    {
                        "name": "shutdown",
                        "lines": 3
                    },
                    {
                        "name": "force-stop",
                        "lines": 3
                    },
                    {
                        "name": "force-reload",
                        "lines": 3
                    },
                    {
                        "name": "force-restart",
                        "lines": 6
                    },
                    {
                        "name": "force-shutdown",
                        "lines": 3
                    },
                    {
                        "name": "try-restart",
                        "lines": 4
                    },
                    {
                        "name": "Additional Commands",
                        "lines": 6
                    }
                ]
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-v",
                        "lines": 2,
                        "flag": "-v"
                    },
                    {
                        "name": "-w",
                        "lines": 1,
                        "flag": "-w"
                    }
                ]
            },
            {
                "name": "ENVIRONMENT",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "EXIT CODES",
                "lines": 11,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "sv - control and manage services monitored by runsv(8)\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "sv [-v] [-w sec] command services\n\n/etc/init.d/service [-w sec] command\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The sv program reports the current status and controls the state of services monitored by the\nrunsv(8) supervisor.\n\nservices consists of one or more arguments, each argument naming a directory service used  by\nrunsv(8).   If  service doesn't start with a dot or slash and doesn't end with a slash, it is\nsearched in the default services directory /etc/service/, otherwise relative to  the  current\ndirectory.\n\ncommand  is  one  of  up, down, status, once, pause, cont, hup, alarm, interrupt, 1, 2, term,\nkill, or exit, or start, stop, restart, shutdown,  force-stop,  force-reload,  force-restart,\nforce-shutdown.\n\nThe  sv  program  can  be sym-linked to /etc/init.d/ to provide an LSB init script interface.\nThe service to be controlled then is specified by the base name of the ``init script''.\n",
                "subsections": []
            },
            "COMMANDS": {
                "content": "status Report the current status of the service, and the appendant log service if  available,\nto standard output.\n\nup     If the service is not running, start it.  If the service stops, restart it.\n\ndown   If the service is running, send it the TERM signal, and the CONT signal.  If ./run ex‐\nits, start ./finish if it exists.  After it stops, do not restart service.\n\nonce   If the service is not running, start it.  Do not restart it if it stops.\n",
                "subsections": [
                    {
                        "name": "pause cont hup alarm interrupt quit 1 2 term kill",
                        "content": "If the service is running, send it the STOP, CONT, HUP, ALRM, INT, QUIT,  USR1,  USR2,\nTERM, or KILL signal respectively.\n\nexit   If  the  service  is  running,  send  it the TERM signal, and the CONT signal.  Do not\nrestart the service.  If the service is down, and no log service exists, runsv(8)  ex‐\nits.   If  the  service is down and a log service exists, runsv(8) closes the standard\ninput of the log service and waits for it to terminate.  If the log service  is  down,\nrunsv(8) exits.  This command is ignored if it is given to an appendant log service.\n\nsv actually looks only at the first character of these commands.\n"
                    },
                    {
                        "name": "Commands compatible to LSB init script actions",
                        "content": "status Same as status.\n\nstart  Same  as up, but wait up to 7 seconds for the command to take effect.  Then report the\nstatus or timeout.  If the script ./check exists in the  service  directory,  sv  runs\nthis  script  to  check whether the service is up and available; it's considered to be\navailable if ./check exits with 0.\n\nstop   Same as down, but wait up to 7 seconds for the service to become  down.   Then  report\nthe status or timeout.\n\nreload Same as hup, and additionally report the status afterwards.\n"
                    },
                    {
                        "name": "restart",
                        "content": "Send  the commands term, cont, and up to the service, and wait up to 7 seconds for the\nservice to restart.  Then report the status or timeout.  If the script ./check  exists\nin  the  service directory, sv runs this script to check whether the service is up and\navailable again; it's considered to be available if ./check exits with 0.\n"
                    },
                    {
                        "name": "shutdown",
                        "content": "Same as exit, but wait up to 7 seconds for the runsv(8) process  to  terminate.   Then\nreport the status or timeout.\n"
                    },
                    {
                        "name": "force-stop",
                        "content": "Same  as  down,  but wait up to 7 seconds for the service to become down.  Then report\nthe status, and on timeout send the service the kill command.\n"
                    },
                    {
                        "name": "force-reload",
                        "content": "Send the service the term and cont commands, and wait up to 7 seconds for the  service\nto restart.  Then report the status, and on timeout send the service the kill command.\n"
                    },
                    {
                        "name": "force-restart",
                        "content": "Send the service the term, cont and up commands, and wait up to 7 seconds for the ser‐\nvice to restart.  Then report the status, and on timeout send  the  service  the  kill\ncommand.   If  the script ./check exists in the service directory, sv runs this script\nto check whether the service is up and available again; it's considered to  be  avail‐\nable if ./check exits with 0.\n"
                    },
                    {
                        "name": "force-shutdown",
                        "content": "Same  as  exit,  but wait up to 7 seconds for the runsv(8) process to terminate.  Then\nreport the status, and on timeout send the service the kill command.\n"
                    },
                    {
                        "name": "try-restart",
                        "content": "if the service is running, send it the term and cont commands, and wait up to  7  sec‐\nonds for the service to restart.  Then report the status or timeout.\n\n"
                    },
                    {
                        "name": "Additional Commands",
                        "content": "check  Check  for the service to be in the state that's been requested.  Wait up to 7 seconds\nfor the service to reach the requested state, then report the status or  timeout.   If\nthe requested state of the service is up, and the script ./check exists in the service\ndirectory, sv runs this script to check whether the service is up  and  running;  it's\nconsidered to be up if ./check exits with 0.\n"
                    }
                ]
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-v",
                        "content": "the command to take effect.  Then report the status or timeout.\n",
                        "flag": "-v"
                    },
                    {
                        "name": "-w",
                        "content": "",
                        "flag": "-w"
                    }
                ]
            },
            "ENVIRONMENT": {
                "content": "SVDIR  The environment variable $SVDIR overrides the  default  services  directory  /etc/ser‐\nvice/.\n\nSVWAIT The environment variable $SVWAIT overrides the default 7 seconds to wait for a command\nto take effect.  It is overridden by the -w option.\n",
                "subsections": []
            },
            "EXIT CODES": {
                "content": "sv exits 0, if the command was successfully sent to all services, and,  if  it  was  told  to\nwait, the command has taken effect to all services.\n\nFor  each  service  that  caused an error (e.g. the directory is not controlled by a runsv(8)\nprocess, or sv timed out while waiting), sv increases the exit code  by  one  and  exits  non\nzero.  The maximum is 99.  sv exits 100 on error.\n\nIf  sv is called with a base name other than sv: it exits 1 on timeout or trouble sending the\ncommand; if the command is status, it exits 3 if the service is down, and 4 if the status  is\nunknown; it exits 2 on wrong usage, and 151 on error.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "runsv(8), chpst(8), svlogd(8), runsvdir(8), runsvchdir(8), runit(8), runit-init(8)\n\nhttp://smarden.org/runit/\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Gerrit Pape <pape@smarden.org>\n\n\n\nsv(8)",
                "subsections": []
            }
        }
    }
}