Shell Script to connect to another server and copying files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell Script to connect to another server and copying files
# 1  
Old 07-24-2010
Shell Script to connect to another server and copying files

Hi Unix Gurus,

I have a doubt reg file transfer. I have used the below script to connect to another server and find files having modified for the last 24 hours and have to move the file to another server.
While i tried i am getting authentication failed, destination path not found issue.

below is my code

Code:
ssh user@server1 <<EOT
cd /path/folder1
find . -mtime -1 
when do file
scp -rp $file user2@server2 /path2/folder2
done
EOT


Last edited by pludi; 07-24-2010 at 05:21 AM..
# 2  
Old 07-24-2010
I usually get this with a password change - check
Bill L.
# 3  
Old 07-24-2010
Code:
ssh user@server1 'find /path/folder1 -mtime -1 -exec scp -rp {} user2@server2/path2/folder2'

but I not sure scp can't do such a thing.

Where do execute this command from? server2?

You need passwordless authentication to server2.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Not able to connect to Oracle server from shell script

Hi, I am facing an issue in connecting to database from Linux shell script. Here is my code export ORACLE_BASE=xxx export ORACLE_SID=xxx export ORACLE_HOME=xxxx DB_PATH=xxx/'yyy@yy' UserId=`sqlplus -s $DB_PATH <<EOF set head off feedback off select max(USER_ID)+1 from USERS;... (6 Replies)
Discussion started by: yuvi
6 Replies

2. 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

3. 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

4. Solaris

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. Kindly let me know on how to do this Thanks, Double post. Continue here (0 Replies)
Discussion started by: amitbhelave
0 Replies

5. 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. Kindly let me know on how to do this Thanks, Ananthi.U (1 Reply)
Discussion started by: ananthi_ku
1 Replies

6. Shell Programming and Scripting

Shell script for copying files from 1 server to other

Hi, I just need a shell script that copies a list of files from a directory in a remote server to my current directory at local server the remote server may contain the following list: /root/pradeep/myfiles/default /root/pradeep/myfiles/dir1 /root/pradeep/myfiles/dir2 ...... (1 Reply)
Discussion started by: paddu
1 Replies

7. Programming

How to write a shell script to connect to another server?

Hello friends I want to write a script in which I will connect to my friends network. I want to use SSH. Even they can use the script to log into my network and copy files. ssh user@hostname command I know the following command will help me to log into Google's servers and see all the... (12 Replies)
Discussion started by: Angelo
12 Replies

8. Shell Programming and Scripting

script for Copying files from one server to another using scp

Hi Scripting experts, I am new to the unix scripting. Please help me out for solving the condition given below I am trying to develop a script for Copying files which are getting generated in server A to server B using scp. In serverA files are generating as for eg abc1.txt, abc2.txt,... (5 Replies)
Discussion started by: rohithji
5 Replies

9. Shell Programming and Scripting

shell script for how to connect to a remote server by using ssh

i want to connect to a remote server through ssh. i have to also provide password within that script. after connecting to the remote server i want to do some operations like grep,cd etc can u pls help me to wite a script. Thanks (1 Reply)
Discussion started by: millan
1 Replies

10. Shell Programming and Scripting

writing script in UNIX for copying files in two server

can anyone help me in writing script in UNIX for copying files in two server from the third server after checking the files in the third server and if there is anything new in the third server automatically it should be added to the rest of the two servers and if same file is existing in the two... (4 Replies)
Discussion started by: REKHA09
4 Replies
Login or Register to Ask a Question