A native Metamod:Source 2.0 plugin that auto-restarts a CS2 server when a game or plugin update is detected, or at a configured daily time.
Intended to be used with CS2Docker, will not work on its own.
Every 10 seconds the plugin checks whether a restart is warranted:
- Out of date -
/watchdog/cs2/latest.txtdiffers from thebuild_verenv var, or any/watchdog/layers/*/latest.txtchanged since the plugin loaded. - Daily restart - the current UTC time has passed
daily_restart_time(once per day). - Already scheduled - a daily restart was previously triggered.
When a restart is warranted:
- If there are no players, it runs
quitimmediately. - Otherwise it prints a chat warning once and waits; it then runs
quitat the next map change.
All read from the environment (set by CS2Docker):
| Env var | Required | Description |
|---|---|---|
build_ver |
yes | Current server build version (provided by cs2docker). |
daily_restart_time |
no | UTC time HH:mm (or HH:mm:ss) for a daily restart. |
discord_webhook |
no | Discord webhook URL; a message posted once per restart decision. |
- This repository is cloned recursively (ie. has submodules)
- python3
- ambuild, make sure
ambuildis in yourPATH - MSVC (VS build tools) on Windows / Clang on Linux
mkdir -p build && cd build
python3 ../configure.py --enable-optimize
ambuilddocker compose run --rm build