Query on sending inputs to a running application


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Query on sending inputs to a running application
# 1  
Old 11-20-2009
Query on sending inputs to a running application

Hi I need a help for below :

I am running an application XXXX , and when it starts i am passing a file name called "connect.spb" and after the application connects to the server i am sending filename "accept.spb" as a parameter.

DL385:$ ./XXXX

This is XXXX (Reproducer by Order or RelaY)


XXXX> @connect.spb

XXXX>Opening connect.spb

Script> SET TCPIP /LOCAL_PORT=15331
Initialised TCP Listener on BL31DL385 (port: 15331)


>@accept.spb

XXXX> Opening accept.spb

So basically Input parameters are @connect.spb and @accept.spb.
After getting first string application will connect to the client ,
Then wait for the input and when accept parameter is given communication established succesfully.



MyQuestion##can we automate this using a script which will first run the application XXXX, and then pass the connect.spb and accept.spb as input
# 2  
Old 11-20-2009
Yes.

Use "expect".

See an example at A Y2K Problem solved with Expect

You'd do something like

#
Code:
!/usr/local/bin/expect -f
spawn Order
expect "XXXX>"
send "@connect.spb"
expect "Initialised TCP Listener"
send "@accept.spb"

and so on, or use "interact" if oiu want to return to keyboard control.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bash pauses while application running

I want a really easy thing to happen, I want the bash to open a picture with QuickPictureViewer (qpv) and then some seconds or after a if function with some specific value that this process is terminated. The problem is, that the bash opens the picture and the script doesn´t go on (because the... (2 Replies)
Discussion started by: SasuGamer
2 Replies

2. UNIX for Beginners Questions & Answers

Application server is running or not

Hi All, i am trying to find whether nginx is installed or not as well process is running or not on my centos server. For that i am searching for the nginx configuration file nginx.conf based on that i am printing the ouput. Below script i am using. var=$(find / -name "nginx.conf" !... (1 Reply)
Discussion started by: balu1234
1 Replies

3. Shell Programming and Scripting

Problem in sending inputs to format command using expect

Hi , I am not able figure out how to use expect tool to send input to this prompt of format Searching for disks...done selecting c0t3d0 FORMAT MENU: disk - select a disk type - select (define) a disk type partition - select (define) a partition... (3 Replies)
Discussion started by: chidori
3 Replies

4. Shell Programming and Scripting

How to interrupt running application?

Hello i have problem passing ctrl+C into shell script this script will run application and return value but never ends and stay running. i tried trap and not working at all the command should look like this : sarm pcsp -s CHG_M_P1 i want something to stop this command after... (9 Replies)
Discussion started by: mogabr
9 Replies

5. Shell Programming and Scripting

Executing SQL Query and sending a mail

Hi all, My reqirenet goes like this. Need to execute one select statement within the script and send a mail to the users with the number of records fecthed from the query. Please help.. Thanks. (3 Replies)
Discussion started by: Achiever
3 Replies

6. UNIX for Dummies Questions & Answers

How to start application and keep script running

What I'm looking for is best explained with a little example. #!/bin/bash gedit echo "I need this message to appear while gedit is still running, but it appears only then when I close gedit." Of course most of the times you want the script to wait, but in this case I want to start a new... (5 Replies)
Discussion started by: MrZehl
5 Replies

7. Shell Programming and Scripting

Know when a particular application is running

Is it possible in unix to write a script that could determine when a particular application is running or not ? (3 Replies)
Discussion started by: zapper222
3 Replies

8. Solaris

How to find an application running on multithread?

Dear Friends, We have one T5240 server with 128vcpus in our lab.Performance of the server is very poor. Application uses only 2% of processor..I heard that single thread application performs slowly in coolthread.How can we find whether the application running on multithread or single thread? If... (7 Replies)
Discussion started by: nicktrix
7 Replies

9. Shell Programming and Scripting

command to know the application running of the port

Hi, is there any command to findout that which application is using the particular port. or whether any port is occupied with the specfic process id ? (4 Replies)
Discussion started by: mail2sant
4 Replies
Login or Register to Ask a Question