Noob Problem (sending CTRL + ] )

Discussion in 'Ruby' started by Sylvain Desbureaux, Sep 25, 2009.

  1. 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/.
    Sylvain Desbureaux, Sep 25, 2009
    #1
    1. Advertising

  2. 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
    Bertram Scharpf, Sep 25, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Danny

    Implement Ctrl-C, Ctrl-V

    Danny, Aug 14, 2003, in forum: C++
    Replies:
    5
    Views:
    638
    CBFalconer
    Aug 15, 2003
  2. Danny

    Implement Ctrl-C, Ctrl-V

    Danny, Aug 14, 2003, in forum: C Programming
    Replies:
    5
    Views:
    650
    CBFalconer
    Aug 15, 2003
  3. Angus
    Replies:
    5
    Views:
    2,088
    Michael Rauscher
    Nov 18, 2006
  4. Replies:
    2
    Views:
    1,397
    Munna
    Jul 10, 2008
  5. Replies:
    0
    Views:
    550
Loading...

Share This Page