Shutting down a Qemu guest from the command line can be quite easy if qemu was started with the -monitor option (eg : -monitor tcp:127.0.0.1:2023,server,nowait). One simply needs to connect to the port using telnet and issue a 'system_powerdown' command. Internally this will trigger an ACPI event, equivalent to power button being pressed (note :a cpid must be up and running for the event to be registered !). For more details refer to the Arch wiki
This can also be scripted, using the netcat tool as the telnet replacement :
echo 'system_powerdown' | nc localhost 2023
However, netcat provided by arch linux (gnu-netcat) won't work (nothing will happen, no acpi event will be triggered) !! One has to install openbsd-netcat, and replace the 'nc' by 'nc.openbsd' in the above example.
Still haven't understood what's going on with GNU netcat. Even tried the --telnet option to honor telnet's escape codes, but with no success.