It's nothing groudbreaking really. It detects that eviction is pending, usually 30s in advance, so it gives 10s notice and then initiates shutdown, properly noting the reason to Event Log.
It's open source and just a handful of lines of code, but way lighter than executing heavy script every second.