# Aeshnidae.GracefulStop

Makes `sudo systemctl stop|restart ace` graceful.

**Why (found 2026-09-27):** the units stop ACE with SIGINT. ACE registers no handler for it,
so .NET ends the process at once; ACE's ProcessExit handler only warns "Unsafe server shutdown
detected! Data loss is possible!" and stops the database. Nobody was logged out and saved, no
landblock was saved (dropped items, corpses), no mod's shutdown hook ran - live's 15:58
restart that day was down and up inside one second. ACE's own graceful path runs on exit only
with `DOTNET_RUNNING_IN_CONTAINER`, and that flag also moves ACE's config, content and
database-update paths to `/ace/...`, so it is not the fix.

**What it does:** registers SIGINT and SIGTERM handlers (`PosixSignalRegistration`), cancels the
default exit, and runs `ServerManager.DoShutdownNow()` on its own thread - exactly an admin's
`/shutdown now`: a world broadcast, every player logged off and saved, every landblock
unloaded and saved (and InstancesNoDat's shared copies with them), the world stopped, mods
shut down, offline players saved, the database queue drained, then `Environment.Exit`. A second
signal is ignored; systemd's `TimeoutStopSec` is the backstop.

No settings, no commands, no patches. `HotReload` off: loaded once at startup (a new mod on
live means a restart anyway).
