{
    "mode": "man",
    "parameter": "service",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/service/8/json",
    "generated": "2026-06-02T21:25:56Z",
    "synopsis": "service SCRIPT COMMAND [OPTIONS]",
    "sections": {
        "NAME": {
            "content": "service - run a System V init script\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "service SCRIPT COMMAND [OPTIONS]\n",
            "subsections": [
                {
                    "name": "service --status-all",
                    "content": "service --help | -h | --version\n"
                }
            ]
        },
        "DESCRIPTION": {
            "content": "service  runs a System V init script or systemd unit in as predictable an environment as pos‐\nsible, removing most environment variables and with the current working directory set to /.\n\nThe SCRIPT parameter specifies a System V init script, located in /etc/init.d/SCRIPT, or  the\nname  of  a  systemd  unit.  The  existence of a systemd unit of the same name as a script in\n/etc/init.d will cause the unit to take precedence over the  init.d  script.   The  supported\nvalues  of  COMMAND  depend on the invoked script. service passes COMMAND  and OPTIONS to the\ninit script unmodified. For systemd units, start, stop, status, and reload are passed through\nto their systemctl/initctl equivalents.\n\nAll  scripts should support at least the start and stop commands.  As a special case, if COM‐\nMAND is --full-restart, the script is run twice, first with the stop command, then  with  the\nstart  command.  Note,  that  unlike  update-rc.d(8),  service  does not check /usr/sbin/pol‐‐\nicy-rc.d.\n\nservice --status-all runs all init scripts, in alphabetical order, with the  status  command.\nThe  status  is [ + ] for running services, [ - ] for stopped services and [ ? ] for services\nwithout a status command.  This option only calls status for sysvinit jobs.\n",
            "subsections": []
        },
        "EXIT CODES": {
            "content": "service calls the init script and returns the status returned by it.\n",
            "subsections": []
        },
        "FILES": {
            "content": "",
            "subsections": [
                {
                    "name": "/etc/init.d",
                    "content": "The directory containing System V init scripts.\n"
                },
                {
                    "name": "/{lib,run,etc}/systemd/system",
                    "content": "The directories containing systemd units.\n"
                }
            ]
        },
        "ENVIRONMENT": {
            "content": "LANG, LANGUAGE, LCCTYPE, LCNUMERIC, LCTIME, LCCOLLATE, LCMONETARY,  LCMESSAGES,  LCPA‐‐\nPER, LCNAME, LCADDRESS, LCTELEPHONE, LCMEASUREMENT, LCIDENTIFICATION, LCALL, TERM, PATH\nThe only environment variables passed to the init scripts.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "/etc/init.d/skeleton\nupdate-rc.d(8)\ninit(8)\ninvoke-rc.d(8)\nsystemctl(1)\n\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Miloslav Trmac <mitr@redhat.com>, Petter Reinholdtsen <pere@hungry.com>\n\nLicense: GNU General Public License v2 (GPLv2)\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "2006 Red Hat, Inc.,  Petter Reinholdtsen <pere@hungry.com>\n\n\n\n\nJan 2006                                                                                  SERVICE(8)",
            "subsections": []
        }
    },
    "summary": "service - run a System V init script",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "update-rc.d",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/update-rc.d/8/json"
        },
        {
            "name": "init",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/init/8/json"
        },
        {
            "name": "invoke-rc.d",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/invoke-rc.d/8/json"
        },
        {
            "name": "systemctl",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/systemctl/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Manage services by running init scripts.",
        "examples": [
            {
                "description": "List the name and status of all services",
                "command": "service --status-all"
            },
            {
                "description": "Start/Stop/Restart/Reload service (start/stop should always be available)",
                "command": "service {{service_name}} {{start|stop|restart|reload}}"
            },
            {
                "description": "Do a full restart (runs script twice with start and stop)",
                "command": "service {{service_name}} --full-restart"
            },
            {
                "description": "Show the current status of a service",
                "command": "service {{service_name}} status"
            }
        ]
    }
}