> For the complete documentation index, see [llms.txt](https://conboi.gitbook.io/oms-wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://conboi.gitbook.io/oms-wiki/addons/watchdog-essentials/empty-server.md).

# Empty Server

**Empty Server** 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 a controlled shutdown through 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]
enabled = true
count_time = "1h"
should_restart = true
```

* `enabled` - turns the feature on or off
* `count_time` - how long the server must remain empty before shutdown is triggered
* `should_restart` - controls whether the shutdown requests a server relaunch through the OMS restart mechanism

***

### Restart Script

Empty Server Shutdown always performs a controlled shutdown through OMS.\
If `should_restart` is enabled, the shutdown also requests a relaunch, which can be handled by the **OMS restart script**.

See [**Restart Script Setup**](/oms-wiki/addons/operate-my-server-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>" %}
