# 7.3.57. `shutdown`

## 7.3.57.1. Summary

`shutdown` stops the Groonga server process.

`shutdown` uses graceful shutdown by default. If there are some running commands, the Groonga server process stops after these running commands are finished. New command requests aren’t processed after `shutdown` command is executed.

New in version 6.0.1: `shutdown` uses immediate shutdown by specifying `immediate` to `mode` parameter. The Groonga server process stops immediately even when there are some running commands.

Note

You need to set Request ID to all requests to use immediate shutdown.

New in version 9.1.2: The Groonga HTTP server accepts immediate shutdown immediately even when all threads are used.

Note

This feature can only use on the Groonga HTTP server.

## 7.3.57.2. Syntax

This command takes only one optional parameter:

    shutdown [mode=graceful]

## 7.3.57.3. Usage

`shutdown` use graceful shutdown by default:

Execution example:

    shutdown
    # [[0, 1337566253.89858, 0.000355720520019531], true]

You can specify `graceful` to `mode` parameter explicitly:

Execution example:

    shutdown --mode graceful
    # [[0, 1337566253.89858, 0.000355720520019531], true]

You can choose immediate shutdown by specifying `immediate` to `mode` parameter:

Execution example:

    shutdown --mode immediate
    # [[0, 1337566253.89858, 0.000355720520019531], true]

Immediate shutdown is useful when you don’t have time for graceful shutdown. For example, Windows kills service that takes long time to stop on Windows shutdown.

## 7.3.57.4. Parameters

This section describes parameters of this command.

### 7.3.57.4.1. Required parameters

There is no required parameter.

### 7.3.57.4.2. Optional parameters

There are optional parameters.

#### 7.3.57.4.2.1. `mode`

Specifies shutdown mode. Here are available shutdown modes:

Value | Description
--- | ---
`graceful` | Stops after running commands are finished. This is the default.
`immediate` | New in version 6.0.1: Stops immediately even if there are some running commands.

## 7.3.57.5. Return value

`shutdown` returns `true` as body when shutdown is accepted:

    [HEADER, true]

If `shutdown` doesn’t accept shutdown, error details are in `HEADER`.

See Output format for `HEADER`.