TrueNAS stop servers before shutdown

I’m planning on putting the computer running my Minecraft servers (MineOS is running as a plugin on TrueNAS) on a UPS and plan on configuring TrueNAS to shutdown when the UPS switches to battery power from mains, is there a way of running the stop command on the servers and waiting for them to finish before the VM/jail shuts down?

If you are using turnkey it has webmin or just look into SNMP itself because you will need to know either way.