markd has asked for the wisdom of the Perl Monks concerning the following question:

Hi I have a perl expect problem. I want to write a perl script that will boot a remote system and while the remote system is booting I want the script to send in ctrl-x at a specific point in the boot. I tried expecting for the line and then sending in the ctrl+x but nothing seems to work

Replies are listed 'Best First'.
Re: perl + expect + signals
by Limbic~Region (Chancellor) on Oct 10, 2003 at 16:03 UTC
    markd,
    I may be completely off base here, but I don't believe what you are trying to do is possible the way you are trying to do it. When a machine is booting up, it typically doesn't have network connectivity. Your Expect functionality requires that. Once network connectivity is established, then you could do what you want.

    If you are trying to interupt the boot sequence or use ctrl-x at some point prior to having network connectivity established, then you are going to need console connectivity. There is functionality in programs such as SecureCRT which allow you to script events to happen based off of text on the screen. Being that this is a remote machine the way to get remote console capability is typically through a terminal server.

    If I completely misinterpreted what you are asking for - please let me know and I will try to help.

    Cheers - L~R

      Actually the setup I have here is I have a serial connection to the machine in question through a terminal server.
        seen as though I am putting in my solutions today I thought that I'd add the solution that worked to this problem too
        I serially connected to the host issued a reset and during the reset (at the point when size was being calculated) I used the following code to break into the host:
        $session->expect(20, "Size:"); $session->send("\030");
        simple really. The ascii codekey seemed to work for ctrl+x and this seemed to be the only thing that worked.