ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a file_one that contains 200 IPs, on which I execute the following command to be broken down to 2 IPs per column:
Code:
awk '{a[NR%2+1]=a[NR%2+1]" "$0} END {for (i in a){print a[i]}}' file_one > file_two
As a result, each column of file_two contains two IPs, and I save each column using awk to 100 files of names ip_list# (i.e., the # sign goes from 1 to 100). After that I run the following script on these 100 files so each file will have its own terminal.
Is there another way to perform this task in more convenient manner so the above script will loop through all the 100 files simultaneously from a single terminal (i.e., one call to the script)?
What’s the problem with running your script will the original file? Do you want to have 2 machines handled in each terminal window instead in one loop across all 200 machines?
Your suggestion seems to work, but for each node I have to provide an RSA-key, username in order to access. I tried the command below, but it gives the following error:
Code:
./parallel-ssh -h q5 -A -l user_name myCommand
Code:
Traceback (most recent call last):
File "./parallel-ssh", line 115, in <module>
hosts = psshutil.read_hosts(opts.host_files, default_user=opts.user)
File "/usr/lib/pymodules/python2.6/psshlib/psshutil.py", line 18, in read_hosts
f = open(pathname)
IOError: [Errno 2] No such file or directory: 'q5
I tried many formats I found online, but no success. Do you know what is the correct format for q5 should be? And please check if the command is not correct.
The script above has no error; it just a matter of simplicity. I need to ssh an X-number of machines every time, say 100 out of 200 simultaneously from one terminal. Clearly, I ask 100 out of 200 nodes to measure certain metric at once using single terminal, and then move to the next set of nodes remaining. I'm looking for some thing, on which I can have control on the number of nodes to be ssh-ed simultaneously.
Now I'm having the first pssh command working correctly, but the second when I try to pass my shell script, it times out although the script is working fine!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.