<html> <head> </head> <body>

I need to run a single command on multiple boxes.  I am pulling the cpu name from an array then plugging them into a loop.  I am then forking the loop so that all of them run at once.<o:p></o:p>

The problem that I am experiencing is: Is there a way to control the number of sessions made at once by the looped fork?  <o:p></o:p>

If I am running the command on 20 servers I am OK.  However, if I need to run it on all 2000 of the boxes, then I run into MAJOR system resource problems.  As a temprary fix I am forking 20 of them, then running 1 outside of the fork. When the 1 from outside of the fork ends then the whole process starts over.  This allows me to do them in CHUNKS of 20.  What I am looking for is a way that allows a new session to start whenever one ends, so that I have a CONSTANT streem of 25 sessions NOT chunks of 25.<o:p></o:p>

##this runs the entire list at once @list=(1,2,3); #list while(<@list>){ #I loop the list if (fork){ #with the loop I run the whole list at once print "$_\n"; #I do my stuff exit; } }
Thanks, BRN </body> </html>

In reply to controling the num of fork sessions by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.