Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send keystrokes in console mode

Status
Not open for further replies.

Reginald0

IS-IT--Management
Apr 18, 2002
28
BR
Hi, folks!

Is there any way (or application) to send keystrokes to buffer in console mode on Linux, like some programs do in command line mode on Windows? (i.e. sendkey.exe)
I want to automate some tasks that requires user intervention on my Linux systems, and I already tried to search on the net for something like this, but without success.
I would be greatly thankful if some of you show me a solution.

PS: Sorry about my poor english, I'm brazilian :)
 
kubla,

I use a lot of programs, including those of my company's internal management system, that don't have any way to run in non-interactive mode.
 
You still havent said what exactly you want to do!

We cannot help unless you explain what it is you'r trying to achieve.

For instance its easy to have a script do a FTP login (unattended) with user:pass to a remote system and get files,
Or
For a ssh user (unattended) to run a process like init 6 on a remote system to reboot it at midnight every day,
Or
A users cron can run any process that is avalible to him/her at various pre-set times.

Almost anything is posible but not with a crystal ball :¬)

Laurie.
 
Ok, I'm sorry not to be more specific. I wish to make a script that will be running all the time on a virtual console, with a user logged in, that will load a program called D3 (a database manager) at specific time, type the initial parameters asked for the program (interactively).
Then, after the program finish to start, type username and password, and the user gets access to program's prompt.
Then, execute a lot of commands, shutdown the program, and go back to script.
If you have any doubts about the process, please ask me.

Thanks,

Reginaldo
 
Im not sure this is what you are asking, but you can redirect input to any program, for example:
programname < response.file , where &quot;response.file&quot; is created by vi and contains the exact responses to the interactive prompts.
 
mrregan,

You're right about it, but how can I simulate non-character keys like ENTER, ESC, TAB, CTRL, etc?
 
when you use vi to create a response file , you can use control-v to insert control characters.
 
It's me again.

I finally decided to learn more about a program called &quot;expect&quot; that comes with the Red Hat CD-ROM and it does what I want. Moreover it's pretty easy to use.

Thanks a lot.

Reginald0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top