Freddie Cash writes: > For everyone's viewing (and critiquing, I guess) pleasure, I present > my version of a kvmctl script. Hi. I have a small 'qemu-send' utility for talking to a running qemu/kvm process whose monitor console listens on a filesystem socket, which I think might be a useful building block when extending these kinds of script to do things like migratation, pausing, and so on. The source is attached. It's careful to extract and pass on the correct command output from kvm and waits for the (qemu) prompt to return before exiting, so you can do stuff like qemu-send /var/run/vm.ctl migrate file:///var/statedumps/foo do-something-with-the-file /var/statedumps/foo without any race problem, and qemu-send /tmp/vm.ctl 'info blockstats' will list the right info without any extraneous command echo or prompt text leaking out. Any comments or feedback welcome, and please feel free to incorporate it where useful. > The only thing I haven't been able to figure out, is how to send a > "shutdown" command from the host OS to the guest OS, such that the > guest OS will do a proper shutdown sequence. You have to switch to > the VM console and manually tell it to shutdown. :( If you have the qemu monitor listening on a unix socket /var/run/vm.ctl, i.e. if you've started the kvm with an argument like -monitor unix:/var/run/vm.ctl,server,nowait you could send a graceful shutdown using qemu-send /var/run/vm.ctl system_powerdown Best wishes, Chris.