How to run the multiple scp from single script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to run the multiple scp from single script?
# 1  
Old 09-09-2010
Question How to run the multiple scp from single script?

Dear Experts,

how to run multiple scp commands from single scripts.

In a directory oracle redo files accumulate. i would like to copy those redo logs to my standby server. For same i am using scp to copy the files. where i am monitoring that as it is sending the files sequentially most of bandwidth unused. I am thinking to do multiple scp session to copy the files. how can i achieve it. I am listing the files to one file and i am splitting that file in to multiple files each file will contains 10 entries.
i.e. if file contains 100 entries then it will split that file to 10 files. and Each spitted file will have the entries like below.
Code:
test1_0001_rf.dbf
test1_0002_rf.dbf
test1_0003_rf.dbf
test1_0004_rf.dbf
test1_0005_rf.dbf
test1_0006_rf.dbf
test1_0007_rf.dbf
test1_0008_rf.dbf
test1_0009_rf.dbf

how can i achieve to run 10 scp session parallely and use that 10 sub-files created as input for transferring the files to my standby server with successfully and using proper utilizing the bandwidth available.

Am working on AIX machine.

Kindly Help me on this.

Thanks Dears, Waiting for all your suggestion.

Thanks in advance...
nmadhuhb

Moderator's Comments:
Mod Comment Use code tags please.

Last edited by nmadhuhb; 09-09-2010 at 05:05 AM.. Reason: Forgotten to add the Unix version using
# 2  
Old 09-09-2010
In your script, just scp the files with nohup and "&" in the end.

Something like:
Code:
# cat redoLogFiles.txt
test1_0001_rf.dbf
test1_0002_rf.dbf
test1_0003_rf.dbf
test1_0004_rf.dbf
test1_0005_rf.dbf
test1_0006_rf.dbf
test1_0007_rf.dbf
test1_0008_rf.dbf
test1_0009_rf.dbf

# cat scpRedoLogFiles.sh
while read redoFile
do
     nohup scp -C -p -c blowfish ${redoFile} <RemoteUser>@<Host>:</path/to/copy/to> 1>scpOutput.log 2>scpOutput.err &
done < redoLogFiles.txt

I hope it helps!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to run simple single command on multiple Linux servers?

Hi All, How can i run a single command on multiple servers with or without giving credentials. I have a file(servers.txt) which has got list of servers and i want to run a command lsb_release -dr on all these servers and get output of those servers against each server. I tried below code... (9 Replies)
Discussion started by: darling
9 Replies

2. Shell Programming and Scripting

Multiple scripts in one single script - crontab

Hello all, Hope all's well. i'm not sure if this is possible but i have some scripts running in a crontab with different intervals, 1min, 5 min, etc. As for a "cleaner" and better control of these scripts (as by time we will have hundred's of scripts used for the same purpose, i.e for Nagios... (4 Replies)
Discussion started by: nms
4 Replies

3. UNIX for Beginners Questions & Answers

A single script to run multiple scripts

Hi , Can someone help! I need a shell script to run multiple scripts by using single shell script, incase any one of the scripts fails, it should get exit and after trouble shooting if we re-execute it, it should start from the failed script. I have a written a scripting till the... (1 Reply)
Discussion started by: anniesurolyn
1 Replies

4. Shell Programming and Scripting

Single script to create multiple directories

Hi , I want a script to create a directories at different locations. suppose i am on home/path/zone1. I want to create a directory of current month in this location. Then i want to create the same current month directory in home/path/zone2.like this for 9 diffrent zones. I can do this... (4 Replies)
Discussion started by: sv0081493
4 Replies

5. Shell Programming and Scripting

Need a script to scp a file to multiple boxes

Hello All, I am new to scripting and I am trying to write a script which can scp a file from one box to multiple boxes. I am thinking to do like this. 1) create a file with list of all server names 2)write a script which will pick up each server line by line from server list and copy it to... (1 Reply)
Discussion started by: sintilash
1 Replies

6. UNIX for Dummies Questions & Answers

How to run multiple command in a single line?

Normally i would do this- cd abc ls -ltr I wish to run above command in a single line, like this- cd abc | ls -ltr But above command doesn't works, it simply runs the second command, ignoring the 1st one. :confused: (4 Replies)
Discussion started by: boy18nj
4 Replies

7. Shell Programming and Scripting

Run a single script in different shell

Hi All, I am new in UNIX.I have a situation here.:confused: I have a script which have to be run in every shell (like KSH,BASH,CSH). Script may be any thing. But i don't know how to do it.Because the syntax of every shell may be different. Please advise.. Thanks for your kind advise in... (5 Replies)
Discussion started by: jdash.ps
5 Replies

8. Shell Programming and Scripting

Script to multiple find and replace in a single file

Dear all I need a script for multiple find and replace in a single file. For example input file is - qwe wer ert rty tyu asd sdf dgf dfg fgh qwe wer det rtyyui jhkj ert asd asd dfgd now qwe should be replace with aaaaaa asd should be replace with bbbbbbbb rty should be replace... (6 Replies)
Discussion started by: wildhorse
6 Replies

9. Shell Programming and Scripting

Script to SCP a file to multiple servers

Hi All, I am a total noob to the Unix world, and i hope to learn a lot from this wonderful community. Here's my first post and question , i am trying to SCP a file to multiple servers (multiple destinations) through this little script : #!/bin/ksh # copy files # File to be copied... (7 Replies)
Discussion started by: rdlover
7 Replies

10. UNIX for Dummies Questions & Answers

How to run multiple command in single command?

Dear Unix Guru, I have several directories as below /home/user/ dir1 dir2 dir3 Each directory has different size. I want to print each directory size (Solaris command du -hs .) Can you please guide me how to achieve this? Thanks Bala (2 Replies)
Discussion started by: baluchen
2 Replies
Login or Register to Ask a Question