Is there a way to run a command inside a domX from dom0 and get its output in dom0 ? -- regards, Anand _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Anand írta:> Is there a way to run a command inside a domX from dom0 and get its > output in dom0 ? > > -- > > regards, > > Anand > >------------------------------------------------------------------------ > >_______________________________________________ >Xen-users mailing list >Xen-users@lists.xensource.com >http://lists.xensource.com/xen-users >ssh (rsh) ? Geza _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Anand wrote:> Is there a way to run a command inside a domX from dom0 and get its > output in dom0 ?SSH? RSH? An expect script that connects to the console, runs your command and disconnects? _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On 1/6/06, Gémes Géza <geza@kzsdabas.sulinet.hu> wrote:> > Anand írta: > > > Is there a way to run a command inside a domX from dom0 and get its > > output in dom0 ?ssh (rsh) ?>Is there any other way apart from ssh/rsh ? -- regards, Anand _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Gémes Géza wrote:> Anand írta: > >> Is there a way to run a command inside a domX from dom0 and get its >> output in dom0 ? >> >> -- >> >> regards, >> >> Anand >> >> > ssh (rsh) ? > > GezaI had a similar problem but could not use networking, so I wrote an Expect script that opened a console into the domU and executed the command. Stephen Brueckner, ATC-NY _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Any ideas on how to implement such a script ? I tried echo "command; exit" | xm console vm01 however it doesn''t work. On 1/6/06, Charles Duffy <cduffy@spamcop.net> wrote:> > Anand wrote: > > Is there a way to run a command inside a domX from dom0 and get its > > output in dom0 ? > > SSH? RSH? An expect script that connects to the console, runs your > command and disconnects? >-- regards, Anand _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Would you mind sharing the script ? On 1/6/06, Steve Brueckner <steve@atc-nycorp.com> wrote:> > Gémes Géza wrote: > > Anand írta: > > > >> Is there a way to run a command inside a domX from dom0 and get its > >> output in dom0 ? > >> > > ssh (rsh) ? > > I had a similar problem but could not use networking, so I wrote an Expect > script that opened a console into the domU and executed the command. > >-- regards, Anand _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Anand wrote:> Any ideas on how to implement such a script ? I tried echo "command; > exit" | xm console vm01 however it doesn''t work.Use expect, as I was suggesting. Even if piping into "xm console"''s stdin worked as you''re suggesting, exiting the shell that''s logged in within a console session isn''t going to exit the console session itself, so that''s an obviously bogus approach. Why aren''t you going the ssh/rsh route? See http://expect.nist.gov/ -- or, if you''re more pythonically inclined, http://pexpect.sourceforge.net/. Expect to do some programming. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
I can''t use the network, so ssh/rsh won''t work. Sorry for my ignorance, i didn''t know about expect. I just looked at the docs and am trying to install it (it complains about tcl even though i have tcl installed :( ) If you some example to help me jumpstart, i will appreciate it. On 1/6/06, Charles Duffy <cduffy@spamcop.net> wrote:> > Anand wrote: > > Any ideas on how to implement such a script ? I tried echo "command; > > exit" | xm console vm01 however it doesn''t work. > Use expect, as I was suggesting. Even if piping into "xm console"''s > stdin worked as you''re suggesting, exiting the shell that''s logged in > within a console session isn''t going to exit the console session itself, > so that''s an obviously bogus approach. Why aren''t you going the ssh/rsh > route? > > See http://expect.nist.gov/ -- or, if you''re more pythonically inclined, > http://pexpect.sourceforge.net/. Expect to do some programming. >-- regards, Anand _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Anand wrote:> Would you mind sharing the script ? > > > On 1/6/06, Steve Brueckner <steve@atc-nycorp.com> wrote: > Gémes Géza wrote: >> Anand írta: >> >>> Is there a way to run a command inside a domX from dom0 and get its >>> output in dom0 ? >>> >> ssh (rsh) ? > > I had a similar problem but could not use networking, so I wrote an > Expect script that opened a console into the domU and executed the > command.Okay, here''s a freebie. This script gets the domU IP. It requires the xenU domain ID as an argument. It is very rough and ugly and tweaked for my machine (FC4), but maybe it will get you started. Oh, and it anticipates that a console might already be open into domU by username "developer". #!/usr/bin/expect -f set ID $argv set timeout -1 spawn xm console $ID match_max 100000 #wake up the console sleep .4 send -- "\r" #there are two cases: expect { #if no console open "login:" { sleep .1 send -- "developer\r" expect "Password:" sleep .1 send -- "developer\r" expect "developer" #if console fully open } "developer" { } } #get ip address sleep .1 send -- "/sbin/ifconfig eth0 | grep ''inet addr:''\r" expect "/sbin/ifconfig" #logout from console send -- "logout\r" expect "logout" sleep .1 send -- ^C" #expect eof _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Anand wrote:> I can''t use the network, so ssh/rsh won''t work.Why can''t you use the network?> Sorry for my ignorance, i didn''t know about expect. I just looked at > the docs and am trying to install it (it complains about tcl even > though i have tcl installed :( ) > > If you some example to help me jumpstart, i will appreciate it.I personally am pythonically inclined, so my experience is with pexpect. If you have specific questions regarding pexpect which won''t take much time to answer, feel free to send me personal mail -- it''s a little far off-topic for an on-list discussion. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Thanks a lot for the script. I am still fighting with expect to get it installed. It gives me the below error everytime i try to do a ./configure checking for Tcl configuration... configure: warning: Can''t find Tcl configuration definitions I have tcl already installed and the tcl source is located in the same directory inside a sub directory tcl. Any ideas ? On 1/6/06, Steve Brueckner <steve@atc-nycorp.com> wrote:> > Anand wrote: > > Would you mind sharing the script ? > > > > > > On 1/6/06, Steve Brueckner <steve@atc-nycorp.com> wrote: > > Gémes Géza wrote: > >> Anand írta: > >> > >>> Is there a way to run a command inside a domX from dom0 and get its > >>> output in dom0 ? > >>> > >> ssh (rsh) ? > > > > I had a similar problem but could not use networking, so I wrote an > > Expect script that opened a console into the domU and executed the > > command. > > > > Okay, here''s a freebie. This script gets the domU IP. It requires the > xenU > domain ID as an argument. It is very rough and ugly and tweaked for my > machine (FC4), but maybe it will get you started. Oh, and it anticipates > that a console might already be open into domU by username "developer". > > #!/usr/bin/expect -f > set ID $argv > set timeout -1 > spawn xm console $ID > match_max 100000 > #wake up the console > sleep .4 > send -- "\r" > #there are two cases: > expect { > #if no console open > "login:" { > sleep .1 > send -- "developer\r" > expect "Password:" > sleep .1 > send -- "developer\r" > expect "developer" > #if console fully open > } "developer" { } > } > #get ip address > sleep .1 > send -- "/sbin/ifconfig eth0 | grep ''inet addr:''\r" > expect "/sbin/ifconfig" > #logout from console > send -- "logout\r" > expect "logout" > sleep .1 > send -- ^C" > #expect eof > > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users >-- regards, Anand _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Anand wrote:> Thanks a lot for the script. I am still fighting with expect to get > it installed. > > It gives me the below error everytime i try to do a ./configure > > checking for Tcl configuration... configure: warning: Can''t find Tcl > configuration definitions > > I have tcl already installed and the tcl source is located in the > same directory inside a sub directory tcl. Any ideas ? >I installed expect using Fedora''s yum package manager. Are you on a distro that has a package manager like yum, apt-get, portage, yast, etc? Is there an expect rpm available? I''m afraid troubleshooting installs is wandering a little far off topic. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Yes i agree, install is too off topic. I will look for rpm''s instead of compiles. Thanks for all the help. On 1/6/06, Steve Brueckner <steve@atc-nycorp.com> wrote:> > Anand wrote: > > Thanks a lot for the script. I am still fighting with expect to get > > it installed. > > > > It gives me the below error everytime i try to do a ./configure > > > > checking for Tcl configuration... configure: warning: Can''t find Tcl > > configuration definitions > > > > I have tcl already installed and the tcl source is located in the > > same directory inside a sub directory tcl. Any ideas ? > > > > I installed expect using Fedora''s yum package manager. Are you on a > distro > that has a package manager like yum, apt-get, portage, yast, etc? Is > there > an expect rpm available? I''m afraid troubleshooting installs is wandering > a > little far off topic. >-- regards, Anand _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users