TrueNAS Scale VM shutdown unreliable

Script was for bhyve hypervisor and formed the command by extracting information from ps using complicated string processing. It seemed to hard to reverse engineer for me.

I now found the right solution: Install QEMU Guest Agent on the guest. This service is included on the VIRT IO driver disk in the Guest Agent directory. On Debian/Ubuntu, this is in the repository as qemu-guest-agent. This seems to work well.