sub fork_backup { my $lpar = shift; if ( ( scalar keys %children ) < $max_children ) { my $pid = fork; if ( $pid ) { # this is parent process $children{$pid} = $lpar; print "Child Backup [$pid][".$children{$pid}."] started at ".localtime()."\n"; $processing_time{$pid} = time(); } else { if ( not defined $pid ) { die "\n\nWoah: Failed to fork a child!\n"; } # this is child process # This is where the meat goes! my $backup_command; if ( ($lpar_oslevel{$lpar}) eq "5.3") { $backup_command = "ls -al /;sleep 20"; } #Put the real sysback command in here later (for 5.3) else { $backup_command = "ls -al /;sleep 30"; } #Put the real sysback command in here later (for all other) # Fire off the backup command, whew! $child_output{$lpar}=`ssh -q $lpar "$backup_command"`; # exit child process exit 0; } } else { # too much child labor! queue for later under complete_backup unshift(@queue,$lpar); } }