Running commands on multiple servers
4,207
Solution 1
I know some tools for that, but the easiest is Fabric. Take a look and tell me what do you think.
Solution 2
Sounds like you're looking for GNU Parallel. That's pretty much exactly what it was written for. In your case, you would do:
parallel ./remote --sshloginfile ALL_SERVERS_IP
The above assumes that ALL_SERVERS_IP
is a text file with one IP or hostname per line. If they can have different logins, make the list like so:
[email protected]
[email protected]
[email protected]
Solution 3
Yes. Try pdsh
, which will execute a command on multiple remote hosts simultaneously. Your task could be written like so:
pdsh -w ssh:$(echo $(<ALL_SERVERS) | sed -e 's/ /,/g') 'printf "%s\n" ...'
Related videos on Youtube
Author by
TheEagle
Updated on September 18, 2022Comments
-
TheEagle almost 2 years
I'am trying to make a navigation bar horizontal but at the moment its vertical. Any help would be great. The problem is that its vertical. I have made the list in html and then used my other file in css to edit it.
HTML:
<html> <head> <link rel="stylesheet" href="Style/style.css" type="text/css"/> </head> <body> <div class="horizontal"> <ul> <li><a href="#">Home</a></li> <li><a href="#">News</a></li> <li><a href="#">Articles</a></li> </ul> </div> </body> <html>
CSS:
div.horizontal { width:100%; height:63px; } div.horizontal ul { list-style-type:none; margin:0; padding:0; } div.horizontal li { float:left; } div.horizontal a { display:block; width:86px; } div.horizontal a:link,div.horizontal a:visited { font-weight:bold; color:#FFFFFF; background-color:#98bf21; text-align:center; padding:4px; text-decoration:none; text-transform:uppercase; } div.horizontal a:hover,div.horizontal a:active { background-color:#7A991A; }
-
Joshua Dwire over 11 yearsI created a jsFiddle (jsfiddle.net/jdwire/dKQxu) with your code, and it displays horizontal. I don't see the problem. (I'm using Google Chrome 25 on Mac.)
-
TheEagle over 11 yearsGuys sorry it was my wrapper class i have fixed this, it was stopping it for some reason. Thanks for the help!
-
depquid almost 10 yearsThere are a bunch of options. This blog lists 10: blog.crdlo.com/2010/07/parallel-ssh-tool-roundup.html
-
slm almost 10 years
-
slm almost 10 yearsThese are related too: unix.stackexchange.com/questions/19008/… & unix.stackexchange.com/questions/3239/…
-
-
PlantTheIdea over 11 yearsit does with a little trick: stackoverflow.com/questions/3754469/…
-
Oleksandr almost 10 yearsI checked on the central server and couldn't find parallel on it.
-
terdon almost 10 years@user67186 you only need to install it on your machine, the one you will launch the job from.
-
Ole Tange almost 10 yearsUse a bash function to give the 'printf/hostname' stuff to run. Then use
--env
to export that function to the remote server:parallel --env myfunc --slf ALL_SERVERS_IP --nonall myfunc
-
Oleksandr almost 10 yearsAll anwsers are useful but I can choose one solution. Thanks!
-
WangJie almost 10 yearsYou're welcome man. I'm glad to help.
-
Jenson over 8 years@terdon How do you have to install parallel? Can't find anything useful.
-
terdon over 8 years@Jenson see the link in my answer. Most Linux distributions (probably all) will have it in their repositories as
parallel
. For others, the link provides download packages.