sub fork_backup { my $lpar = shift; if ( ( scalar keys %children ) < $max_children ) { my $pid = (open($lpar,"-|")); if ( $pid ) { # this is parent process $children{$pid} = $lpar; print "Child Backup [$pid][".$children{$pid}."] started at ".localtime()."\n"; print MAINLOG "\nChild Backup [$pid][".$children{$pid}."] started at ".localtime( )."\n"; $processing_time{$pid} = time(); open(HOSTLOG,">>./$main_log_dir/$lpar.out"); print HOSTLOG "\nChild Backup [$pid][".$children{$pid}."] started at ".localtime( )."\n"; close(HOSTLOG); } 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" || ($lpar_oslevel{$lpar}) eq "6.1" ) { $sysbackcmd="blah"; print "Sysback Command - 5.3: $sysbackcmd\n"; #Put the real sysback command in here later (for 5.3) exec("ssh -q -o ConnectTimeOut=5 $lpar \"$sysbackcmd\""); #Put the real sysback command in here later (for 5.3) } else { $sysbackcmd="blah"; print "Sysback Command: $sysbackcmd\n"; exec("ssh -q -o ConnectTimeOut=5 $lpar \"$sysbackcmd\""); } # exit child process exit 0; } } else { # too much child labor! queue for later under complete_backup unshift(@queue,$lpar); }