run a application from a remote server via script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting run a application from a remote server via script?
# 1  
Old 10-26-2005
run a application from a remote server via script?

I have a ksh script that does a bunch of things, then runs

telnet server_b

I then manually login, manually run one command (which launches an application with display back to my workstation), then logout at which point the main script takes back over, runs something else, then ends.

Is there anyway to automate the manual parts?
# 2  
Old 10-26-2005
Have you tried a here document?

Code:
telnet somenode<<EOF
username
password
special_command
exit
EOF

# 3  
Old 10-26-2005
Jim,

What is a here document?

Also, that solution does not work, just tosses me back out to my orig host.
# 4  
Old 10-26-2005
you should really look into using "expect", but here's a 'poor-man' attempt to do it with the 'pipped' "telnet":
Code:
#!/bin/ksh

host='myHost'
user='anyUserName'
pass='aPassword'

    (
    sleep 3
    print "${user}"
    sleep 1
    print "${pass}"
    sleep 2
    print "ls ~"
    sleep 1
    print "exit"
    sleep 3
    ) | telnet "${host}"


Last edited by vgersh99; 10-26-2005 at 05:19 PM..
# 5  
Old 10-26-2005
Thanks vgersh99,

Looks somewhat like sendkeys (VBA command). I looked up expect. Looks like I'll need to play with it a lot before getting it to work, but undoubtedly a better approach.

Thanks for the help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Except script to run a local shell script on remote server using root access

local script: cat > first.sh cd /tmp echo $PWD echo `whoami` cd /tmp/123 tar -cvf 789.tar 456 sleep 10 except script: cat > first #!/usr/bin/expect set ip 10.5.15.20 set user "xyz123" set password "123456" set script first.sh spawn sh -c "ssh $user@$ip bash < $script" (1 Reply)
Discussion started by: Aditya Avanth
1 Replies

2. Shell Programming and Scripting

Script connect to remote server, not find files and exit only from remote server, but not from scrip

I have a script, which connecting to remote server and first checks, if the files are there by timestamp. If not I want the script exit without error. Below is a code TARFILE=${NAME}.tar TARGZFILE=${NAME}.tar.gz ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly;... (3 Replies)
Discussion started by: digioleg54
3 Replies

3. Ubuntu

Run a script at remote server without ssh password

Hello, What I want to do is to run a file on remote server by running a script at localhost but script should not ask ssh password of my remote server when script is executed. Scenario1: To copy files from server2 to data server:$ scp -r root@server2_ip:/var/www/html/*.* /var/ When I enter... (6 Replies)
Discussion started by: baris35
6 Replies

4. Shell Programming and Scripting

To run a shell script in remote server from windows batch file

Hi all, i need to run a shell script on remote server. I have created file .bat file in windows server with following code, c:\Users\Desktop\putty.exe -ssh -pw password user@server ./script.sh i need to run the script.sh in my remote server Above command is not working, any... (4 Replies)
Discussion started by: rammm
4 Replies

5. Shell Programming and Scripting

Need script to run the command in remote server

hi, I need script to perform below task. 1. Read the IP address 2. copy the script from origin server to destination. 3. get root access on destination server 4. run the script on destination server 5. return to the origin server Code: #!/bin/bash echo "Enter Server IP... (5 Replies)
Discussion started by: bapu1981
5 Replies

6. Shell Programming and Scripting

Copy and run that script in Remote server

Hi All, I need script to perform below task. 1. I have a script in one server and need to copy this script to remote server 2. login in to remote server 3. run the script which i copied to this server. #!/bin/bash read a scp /tmp/script.sh user@hostname:/tmp ssh user@$a ./scirpt.sh ... (2 Replies)
Discussion started by: bapu1981
2 Replies

7. HP-UX

how to check remote server port listening from application.

Hi, I have an application running on HP-UX, from this application I need to findout if the port number. lets say 7890,7891, 7892 are listening on the remote server running on HP-UX. Is there any way of doing it using "system()" function or any other? I noticed that nmap, netcat are not... (0 Replies)
Discussion started by: einsteinBrain
0 Replies

8. Shell Programming and Scripting

How to run perl script in remote machine from java application?

Hi I am working in a java application. I need to execute a perl script(linux) which is in remote machine in java application from local machine(windows). I need to do this process automatically that is without manual intereption. Now I will explain the process clearly, at present to run the... (1 Reply)
Discussion started by: bassma
1 Replies

9. Shell Programming and Scripting

Need help on how to exit a script run on a server from a remote server

hi, I am using the below line to run a script from remote server(say server A) to another server(say server B). ssh username@servername ksh script name. The issue is the script logs into server B, executes the script on server B, transfers the file to server A but does not exit from... (4 Replies)
Discussion started by: yohasini
4 Replies

10. Programming

Expect script to run a Shell script on remote server

Hi All, I am using a expect script to run a shell script on remote server, the code is as follows. But the problem is that it executes only first command, and hangs it doesn't run the next commands. spawn ssh $uid@$host expect "password:" send "$password\r" expect "*\r" send... (2 Replies)
Discussion started by: yashwanthsn
2 Replies
Login or Register to Ask a Question