From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alberto =?iso-8859-15?q?Trevi=F1o?= Subject: Re: howto control VM from outside (shutdown...) Date: Tue, 20 Jan 2009 08:55:28 -0700 Message-ID: <200901200855.28307.alberto@byu.edu> References: <4974E154.5020404@gmail.com> <4974F334.7010200@mair-family.org> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit To: KVM List Return-path: Received: from pto.byu.edu ([128.187.16.44]:22161 "EHLO webmail-int.byu.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756685AbZATQAb (ORCPT ); Tue, 20 Jan 2009 11:00:31 -0500 In-Reply-To: <4974F334.7010200@mair-family.org> Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: On Monday 19 January 2009 02:40:04 pm David Mair wrote: > Take a look at the qemu -monitor option. You can use it to re-direct the > monitor console to a large number of character devices, including > sockets. The settings are the same as for the -serial option. I've used > it to access the monitor console from a telnet client. I use the the telnet option: -monitor telnet::[port],server,nowait For interactive control I use telnet: $ telnet localhost [port] and I can connect to it to run any commands I want. Just be aware that you should exit with Ctrl-C or by making sure you are at the telnet prompt when you issue quit. If you issue quit to the VM, the entire VM will shutdown very, very quickly and ungracefully. To send commands through a script, I use netcat: echo "system_powerdown" | netcat -T -c localhost [port] I also have a PHP script that opens a socket connection to the telnet port, sends the command, and parses the output for errors. I'll be happy to share it. Let me know if you want it.