I'm running Home Assistant Core in a Python venv on Ubuntu. My UPS monitor (NUT) triggers a system shutdown via shutdown -h +0 when the battery is low. Before the system shuts down, systemd sends SIGTERM to all services including the HA process.
I checked the HA source code for any SIGTERM handler but couldn't find one:
grep -r "SIGTERM\|signal.signal" ~/homeassistant/lib/python*/site-packages/homeassistant/
This returned no results.
My concern is that HA gets killed hard by SIGTERM without flushing its state, closing the database etc.
Does HA handle SIGTERM gracefully, or is it a hard kill?
(I know that HA core is no longer supported but maybe there people which answer anyway)