Connect to differect server and execute the script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Connect to differect server and execute the script
# 1  
Old 08-13-2009
Connect to differect server and execute the script

Hello Everyody

Please help me with the below problem.

I have two servers names server1 and server2.
From server1, i have to connect to server2 and execute a script residing on server2. How can i achieve this?
# 2  
Old 08-13-2009
The commands you are looking for are rsh and/or ssh. Lots of online docs on how to use them...
# 3  
Old 08-13-2009
server1> ssh user@server2 command
# 4  
Old 08-13-2009
Quote:
Originally Posted by peterro
server1> ssh user@server2 command
I have tried this and it is working. if i do it manually, command will prompt me for the password, and after entering, it will execute the script on the other server.
But i wish to automate. Like, i will create a script named script1 , i wish to place the ssh command to connect to other server and execution of other script. It should not prompt me for a password. Is this possible?
# 5  
Old 08-13-2009
Yes, you would just then be configuring ssh to accept user@system1 without a password. You should easily be able to find configuration for this.
# 6  
Old 08-13-2009
Quote:
Originally Posted by vasuarjula
[...]
command will prompt me for the password,
[...]
It should not prompt me for a password. Is this possible?
Search this site (on the top right) for "public key authentication"
# 7  
Old 08-14-2009
keybased login

You have build a trust relation between those 2 server. you can find N nunbers of document floating around on this topic.

Google it out..!!!!Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Connect to database server and execute sql

I have a requirement and below is the detail. Create a shell script and needs to run in server "a". Connect to teradata database server "b". execute the .sql file from server "a" Save the output of the query to a file in server "a" Schedule this shell script to run every day for every 4... (1 Reply)
Discussion started by: MadhuSeven
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. Shell Programming and Scripting

Sudo connect to a remote server and execute scripts in remote server

Hello Every one!! I am trying to write a shell script which will connect to a remote server and execute scripts which are at a certain path in the remote server. Before this I am using a sudo command to change the user. The place where I am stuck is, I am able to connect to the... (6 Replies)
Discussion started by: masubram
6 Replies

4. Shell Programming and Scripting

Shell script to connect from one server to other

Dear Experts, I am new to the shell scripting. I am looking for a shell script to connect to one Unix/Linux server1 to other Unix/Linux server2 and trigger a SAP Event in that server2 (Which will trigger a job in SAP). Is this possible to connect from one server to the other server securely... (7 Replies)
Discussion started by: Venu V Reddy
7 Replies

5. Shell Programming and Scripting

Shell script to copy a file from one server to anther server and execute the binary

Hi , Is there any script to copy a files (weblogic bianary + silent.xml ) from one server (linux) to another servers and then execute the copy file. We want to copy a file on multiple servers and run the installation. Thanks (1 Reply)
Discussion started by: Nawrajesh
1 Replies

6. Shell Programming and Scripting

Connect (SSH) to Windows server via Linux server through a script and passing command.. but failing

I am trying to connect to Windows server via Linux server through a script and run two commands " cd and ls " But its giving me error saying " could not start the program" followed by the command name i specify e g : "cd" i am trying in this manner " ssh username@servername "cd... (5 Replies)
Discussion started by: sunil seelam
5 Replies

7. Shell Programming and Scripting

connect to SQL server from shell script

Hi all, I need to connect to SQL server from shell script. Then need to execute queries from shell script as below 1. To compare values of an array with SQL table's entry. I am using solaris-5.1 to run shell script and want to connect to SQL-5.1 which is installed on SantOS. Kindly let... (3 Replies)
Discussion started by: amitbhelave
3 Replies

8. Shell Programming and Scripting

Script to connect to a remote server and execute scripts

Hello All I need a script or set of commands which can establish a remote connection with another server and execute some scripts over there. Basically it has to establish the connection with the remote server as an user ,say 'testuser' and then execute the script 'testscript'. and return the... (5 Replies)
Discussion started by: sgbhat
5 Replies

9. UNIX for Advanced & Expert Users

execute a script on test server from dev server

I need to execute a script from dev server which is located on Test server.I can use ftp to connect to dev server and from there how can i execute a command on test server. Thanks (5 Replies)
Discussion started by: ukatru
5 Replies

10. Shell Programming and Scripting

how to connect sftp server using script

Hi friend I have a command: sftp -v dtxsttp90102@dtx.us.dell.com I need to connect sftp server using above command and grep for some files and need to back to script can anyone tell me how to write script connectingSFTP.sh -------------------- sftpCmd=`sftp -v... (1 Reply)
Discussion started by: kittusri9
1 Replies
Login or Register to Ask a Question