Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Noob Problem (sending CTRL + ] )

Reply
Thread Tools

Noob Problem (sending CTRL + ] )

 
 
Sylvain Desbureaux
Guest
Posts: n/a
 
      09-25-2009
Hi all,
I want to create a script which will execute the following tasks:
launch a console on a virtual server via libvirt:
virsh console NameOfTheServer
Log into the server
login \n
password\n
send a command inside the server
command
send CTRL + ]


I'm first not sure how to send the command after sending an os command.
and I definitely don't know how to send the special key CTRL + ] (^])

Any ideas?

Thanks
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Bertram Scharpf
Guest
Posts: n/a
 
      09-25-2009
Hi,

Am Freitag, 25. Sep 2009, 17:59:54 +0900 schrieb Sylvain Desbureaux:
> virsh console NameOfTheServer
> Log into the server
> login \n
> password\n
> send a command inside the server
> command
> send CTRL + ]
>
>
> I'm first not sure how to send the command after sending an os command.
> and I definitely don't know how to send the special key CTRL + ] (^])


Ctrl-] is "\x1d".

I don not clearly understand what you want to do but maybe this
helps. I once wrote a tool that feeds the input queue with some
characters before executing another process. To use it write
something like:

fork {
$stdin.unget "login username\rpassword verysecret\rsomecmd\r\x1d"
exec "telnet otherhost 110"
}

And there you are. Notice that the enter key sends "\r", not "\n".
Here's the source code:

http://www.bertram-scharpf.de/tmp/termins.c
http://www.bertram-scharpf.de/tmp/termins.h

Bertram


--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
The richtextbox not receiving the keys such Ctrl+A, Ctrl+O when typedon it when hosted on web page Gouri.Mahajan7@gmail.com ASP .Net 0 07-11-2008 05:27 AM
Disabling the shortcuts such as Ctrl+A, Ctrl+B.... using Javascript Gouri.Mahajan7@gmail.com ASP .Net 2 07-10-2008 08:15 AM
How to intercept Ctrl key - eg Ctrl E being pressed on Java console program Angus Java 5 11-18-2006 04:19 PM
Implement Ctrl-C, Ctrl-V Danny C++ 5 08-15-2003 03:04 AM
Implement Ctrl-C, Ctrl-V Danny C Programming 5 08-15-2003 03:04 AM



Advertisments