[sf-perl] parallelize system tasks, collecting statuses and output

Randal L. Schwartz merlyn at stonehenge.com
Sat Mar 15 08:16:08 PDT 2008

>>>>> "David" == David Alban <extasia at extasia.org> writes:

David> our sysadmins regularly need to restart a service on, say thirty
David> machines.  the service takes two and a half minutes to restart.  i'd
David> like to write a perl program they can use to parallelize the restart.
David> so that the whole operation takes three minutes rather than an hour or
David> more.  i want to collect the statuses and any output of the service
David> restart commands.

David> i found the Bidirectional Communication with Yourself section of the
David> perlipc man page.  i'm trying to hack their example so that only the
David> child writer writes to the parent reader.  my hacked version forks two
David> child processes, which i want to run in parallel.  each child process
David> ssh's to a host, sleeps a small amount of time, and then runs the
David> hostname command.  but the child procs seem to be running serially.

"Getting your kids to do the work"

Or, just look at Parallel::ForkManager in the CPAN.

Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

More information about the SanFrancisco-pm mailing list