LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-29-2012, 11:40 PM   #1
suboss87
Member
 
Registered: Dec 2010
Posts: 31

Rep: Reputation: 0
Red face How to push the script remotely to many servers by ssh or scp


Hi All,
I am having a script and I need to push that script remotely from my Linux machine to more than 50 servers. Please guide me how to push the script to all those servers remotely.

Note:

I need to write the script like this -- all ip-address of the server kept in an single file, So that the script should read the file and push it to each sever.

Kindly guid me the possible ways to do this..

Last edited by suboss87; 07-30-2012 at 12:42 AM.
 
Old 07-30-2012, 01:22 AM   #2
yahoosam
Member
 
Registered: Jun 2012
Posts: 79

Rep: Reputation: Disabled
i think u should think of curl libraries..
check out on googling
http://curl.haxx.se/libcurl/c/libcurl-tutorial.html

Last edited by yahoosam; 07-30-2012 at 04:32 AM.
 
1 members found this post helpful.
Old 07-30-2012, 11:25 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/

UNTESTED, but basically like this
Code:
for ip in `cat ip_file`
do
    scp file user@${ip}:/dir
done
You'll need to have setup ssh-auth-keys to automate login process
http://www.linuxtopia.org/online_boo...erate-keypairs
 
  


Reply



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
Multiple scp/ssh in one bash script Lovelyhard Programming 13 07-31-2012 09:37 AM
Bash script using scp and ssh Drigo Linux - Newbie 6 08-05-2011 05:04 AM
Running multiple commands remotely via SSH in a script gimpy530 Linux - General 4 12-19-2009 10:22 PM
Shell Script with ssh & scp ErikJohnson Linux - Software 3 03-11-2004 04:53 PM
Shell Script with ssh & scp ErikJohnson Linux - Networking 1 03-11-2004 04:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:51 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