Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a parallel program

Status
Not open for further replies.
Apr 13, 2004
316
US
Is there a way to use Perl to create a parallel command that would execute a program across multiple servers in parallel.

I have spent 5 years on IBM’s SP2 system that has parallel commands that run on all servers simultaneously and precludes one from having to log into each system to run a command. Also, if I have to copy a file to each server I can use ‘pcp’ parallel copy.

The reason I want this is because the company has bought 45 Solaris SPARC servers and I do not want to log into every server. As of now, I have a script that executes telnet and runs a command, but it takes about 10 seconds for each telnet, login, password, run command, disconnect.

So let me know if this is possible with Perl – and how. I use ksh for most everything and my Perl is left to one liners.

Thanks.
 
Presumably you could spawn or pipe several scripts across servers but you'd still have to pass the login info to each machine. As I recall, the SP2 parallel command was specific to the IBM OS. AFAIK, there is no PERL command for something like this.

There's always a better way. The fun is trying to find it!
 
In the scenario given, is there any chance you could write a perl-daemon that listens on a certain port to a master host, and if a command string is there, pull it from the master, and execute it.

This is a possible security hole, so caution would be advised - pass a check sum with command might be a poss. solution

It would invalidate the need to logon to each machine, and each machine would pull the file from the master, which would mean less pushing from the master host.

You could even cascade along servers, but this gets away from the parallelism you require

HTH
--Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
Have a look at the Net::Telnet module. If you don't have it already it can be downloaded from
Convert your shell script logic into Perl - so that you can do what you do now but in Perl. After that you can use fork() to get the jobs running in parallel.

Do it one stage at a time though, you'll get your knickers in a twist otherwise, using fork() can be tricky until you get used to it.

Mike

"Deliver me from the bane of civilised life; teddy bear envy."

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top