Showing results for 
Search instead for 
Did you mean: 

Terminal: Sending specicial keys

Level 1
Level 1

I've been trying to find some info on this, but have been unsuccessful.

Can anyone tell me how to send sequences to the terminal such as ctrl-b and arrow keys?

I need to write a terminal script that can arrow down through a menu and select an option.

11 Replies 11

Level 1
Level 1

Also, when you add commands to an "Execute Terminal Command" activity, should it send a carriage return after it?

I'm assuming it does something along those lines.

I'm connecting to a HP Infinity iLO session, and I send "co" to enter the console which works fine.

Then I issue "exit" and it should exit a CLI and enter a menu.

However, if I share the console, I see the exit command, but it appears that either the carriage return (enter) has not been sent, or it was ignored.

Has anyone seen this issue?

Once I get past this, I'm going to have to issue a "v" and then another carriage return/enter, so I really need this to work.

That sounds like it should work.  I did see issues like that, but it was a *long* time ago in very early iterations of that adapter.

Try adding a newline in your command list after the exit

(though that really should send two carriage returns).

You may also have issues with expects.  Driving a menu may not send anything back that can be read in stdout.  You can get to the menu with the normal send-and-expect and then have another Execute Terminal Command activity that is configured using the send-all-at-once checkbox to drive the menu, but it might go too fast for the menus.

Thanks for the response Michael.

It's definitely not an expect issue, because I can connect to the console from another SSH session and see that the word "exit" has been entered to the console, but the key has not been sent afterwards.

If I take over control of the console and just press enter, it exits the CLI and enters the menu as I would expect.

Below is the input I have tried - as you can see, there are two blank links below the "exit". I was hoping this would send a couple linefeeds.

When I run the command, it successfully issues "co" to enter the console, but the "exit" command times out waiting for output.

Now if I manually go to the console in my own ssh session, this is what I see.

I can then press enter and the exit command works.

The menu I will worry about later. If I can work out the line feed/carriage return issue, I can get past the menu without waiting for output.

Is it possible that the console is expecting a line feed instead of carriage return, or vice versa?

What does Orchestrator send at the end of each command?

What do your expects look like in the "Exit to menu" activity?

The default expects might be looking for >, which never appears.  One way to test for this is to add a .* expect, which will succeed regardless of what comes back.

Assuming anything comes back.  I'm concerned that the menu interface isn't behaving the same way as regular command line interaction.

It definitely is supposed to send a carriage return after each command.

Thanks Michael,

I'm not sure I'm following the expect issue.

My understanding is that even if the expect was broken, but the exit command was working properly, when I connect to the console, the menu I'm expecting would be showing wouldn't it?

If the expect was broken, the command (exit ) should still be submitted, but the activity would fail because of the broken expects.

Even with that activity failing, I should be able to manually ssh to the iLO console and see the menu that the exit command should have triggered.

This is the menu I should see, but because the exit command is not properly submitted, I don't see how the expects will actually be used. My expect contains "^.*EFI\sBoot\sManager" when it gets that far.

That's the part I'm not sure is actually behaving the same was as cmdline ssh.

Try an expect that says ".*Live\sConsole.*

On further thought, I don't think this menu/shell is using SSH stdout.


A consistent API is one of the advantages to UCS servers


This thread indicates that you can do some of this via commands.

That thread also mentions that some of these things can't be done programmatically; you have to be interactive. In most *nix systems, there is a command for anything you can do through menus/shells.  I haven't messed with HP ILO in over 10 years, so I'm a little out of touch, but I would recommend trying to find ways to do it through commands rather than through menus.

"Live Console" is part of the expect of the previous command, and because I copied and pasted that command, it's part of the command that's not working too.

"Live Console" comes up when you first connect to the console, not after you send the exit command.

The issue is that the exit command is not being submitted, so there is no output for the expect to look for.

After the activity fails, the output is shown below.

To prove that this is an issue with the carriage return, I can submit multiple commands:

And here is the console:

Now just to be clear - the "Live Console" text comes up whenever you connect to the console, so it was not there when the exit commands were submitted.

That's fine... I can issue the boot command instead of using the menu, but the boot command will be issued from the same shell, so it's going to have the same issue.

Please let me know if using the boot command works.

I spoke to engineering about this and

a) HP iLO is "not supported" because it does funny stuff with SSH like this

b) They asked that you open a TAC case so we can log a bug or enhancement request on this and figure out the workaround.  We do want to be able to work with it.

I wonder if it would be a matter of adding a couple of extra options in the "ends with special character" drop down.

Maybe if both linefeed and carriage return were added here it may work. Surely the enter key has to be doing one of those.

I tested using the ctrl-b special character and that definitely works - it exits the console as expected.

Strange thing is - the rest of ilo works fine. I can issue the "co" command no problem. It's only once inside console mode that things go pear shaped with the enter key.

I will see if I can work out how to raise a TAC case.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: