# Empty Server Shutdown

**Empty Server Shutdown** is a feature provided by the `watchdogessentials` addon.\
It monitors player activity and requests a controlled shutdown if the server remains empty for a specified period.

This feature is useful for automatically stopping idle servers and saving resources when no players are online.

***

### Behavior

Once enabled, the feature:

* Starts a countdown when the last player leaves the server
* Cancels the countdown if a player joins again
* If the server remains empty for the configured time, requests shutdown via OMS

This does **not** restart the server by itself. You must use a restart script to bring it back online after shutdown.

***

### Configuration

Config file:\
`world/serverconfig/watchdogessentials-server.toml`

```toml
[features.empty_server_restart]
enabled = true
count_time = "1h"
```

* `enabled` - turns the feature on or off
* `count_time` - how long the server must remain empty before shutdown is triggered

***

### Restart Script Optional

This feature only shuts the server down.\
To enable full restart behavior, pair it with a proper launch script.

See - [Restart Script Setup](/oms-wiki/addons/operatemyserver-addon/scheduled-restart/restart-script-setup.md)

***

### Stop Reason

This feature introduces the stop reason:

{% @github-files/github-code-block url="<https://github.com/c0nnor263/OperateMyServer/blob/main/addon/watchdog-essentials/feature/empty-server/src/main/kotlin/io/conboi/oms/watchdogessentials/feature/emptyserver/foundation/reason/EmptyServerStop.kt>" %}

***

### Priority

This feature is registered with `Priority.COMMON`.\
It is considered a safe, low-impact utility feature.

***

### Source Code

This feature is part of the `watchdogessentials` addon.

{% embed url="<https://github.com/c0nnor263/OperateMyServer/tree/main/addon/watchdog-essentials/feature/empty-server>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://conboi.gitbook.io/oms-wiki/addons/watchdog-essentials/empty-server-shutdown.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
