LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-10-2014, 03:44 AM   #1
massy
Member
 
Registered: Nov 2013
Distribution: CentOS 6.4
Posts: 209
Blog Entries: 1

Rep: Reputation: Disabled
How to transfer a file to some hosts from a server?


I have some IP addresses in a file and I should send a file to all of them I tried scp in a while loop but it works only for the first.
how to transfer my file to some hosts?
 
Old 06-10-2014, 03:46 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,461

Rep: Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552
Are you doing this with a script? If so, then show us what you've done so far.
 
Old 06-10-2014, 04:28 AM   #3
massy
Member
 
Registered: Nov 2013
Distribution: CentOS 6.4
Posts: 209

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by TenTenths View Post
Are you doing this with a script? If so, then show us what you've done so far.
Code:
#!/bin/bash
while read IP

do
     /usr/bin/scp /home/farid/Package/sudo_1.8.5p2-1+nmu1_i386.deb check@$IP:/home/check

done < IPvar
 
Old 06-10-2014, 04:40 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,692

Rep: Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274Reputation: 7274
Code:
#!/bin/bash
# insert it to debug your script
set -xv 

while read IP

do
     # echo loop variable
     echo $IP
     /usr/bin/scp /home/farid/Package/sudo_1.8.5p2-1+nmu1_i386.deb check@$IP:/home/check

done < IPvar
you can insert those lines to check what's happening.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
samba file transfer is different from server to server Gil@LQ Linux - Networking 7 01-19-2013 07:25 AM
[SOLVED] Can't transfer a file to a server eantoranz Linux - Networking 6 08-24-2012 11:10 AM
Transfer file from one server to other Muhammad Awais Linux - Networking 37 04-19-2012 10:37 PM
HOWTO transfer Hosts in excel sheet to file in LINUX? manalisharmabe Linux - Newbie 2 11-07-2011 01:18 PM
a simple file transfer server.. sachitha Programming 2 09-09-2006 08:08 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration