diff options
author | etienne | 2007-02-01 14:44:24 +0000 |
---|---|---|
committer | etienne | 2007-02-01 14:44:24 +0000 |
commit | 399cea5af494c91726d2f68c7f9e41ff27c48497 (patch) | |
tree | 85988fde2b78fe65aca109507b71444db5697b0f /FugueConfig.pm | |
parent | ef955c3c8f727aa7cef3a289d4a6eeaf81ba9f41 (diff) | |
download | ivylaunch-399cea5af494c91726d2f68c7f9e41ff27c48497.zip ivylaunch-399cea5af494c91726d2f68c7f9e41ff27c48497.tar.gz ivylaunch-399cea5af494c91726d2f68c7f9e41ff27c48497.tar.bz2 ivylaunch-399cea5af494c91726d2f68c7f9e41ff27c48497.tar.xz |
modif du process d'execution des agents pour faire fonctionner ivycontrolpenelt en etch
Diffstat (limited to 'FugueConfig.pm')
-rw-r--r-- | FugueConfig.pm | 101 |
1 files changed, 56 insertions, 45 deletions
diff --git a/FugueConfig.pm b/FugueConfig.pm index 23d05e5..dfda1b0 100644 --- a/FugueConfig.pm +++ b/FugueConfig.pm @@ -99,6 +99,18 @@ sub launchAgent { } # end launchAgent +sub execAgentBackground { + + my ($appname, $host, $command, $options, $bus) = @_; + $options .= " -b $bus" if $bus; + my $command_opt = $command; + $command_opt .= ' '.$options unless $options =~ /^\s*$/; + $command_opt = "$rsh -n $host '$command_opt'" + unless $host eq 'localhost' or $host eq hostname(); + system("($command_opt 2>&1)&"); + +} # end execAgentBackground + # launch a given command (not an ivy agent) on a given host sub launchCommand { @@ -114,51 +126,50 @@ sub launchCommand { sub _launch { - my ($label, $host, $command_opt, $type) = @_; - my $pid = fork; - warn ("[FugueConfig][WARNING] Could not fork $type \'$command_opt\'!\n"), return - unless defined $pid; - - # parent P1 - if ($pid) { - print "[FugueConfig][INFO] launch on $host $label $type \'$command_opt\' ". - "(pid=$pid)\n"; - return ($pid); - - # child P2 - } else { - - # overload parent trap - $SIG{INT} = 'DEFAULT'; - - # remote command - $command_opt = "$rsh -n $host '$command_opt'" - unless $host eq 'localhost' or $host eq hostname(); - - pipe(READER, WRITER); - WRITER->autoflush(1); - my $pid2 = fork; - warn ("[FugueConfig][WARNING] Could not fork $type \'$command_opt\'!\n"), - return - unless defined $pid2; - # parent P2 - if ($pid2) { - close READER; - CORE::open(STDOUT, ">&=WRITER") or - die "[FugueConfig][WARNING] Couldn't redirect STDOUT"; - exec "$command_opt 2>&1 " or - die "[1m[FugueConfig][WARNING] Couldn't launch $command_opt[m"; - # child P3 - } else { - close WRITER; - while(<READER>) { - chomp(); - print "[1m$label[m $_\n"; - } - close READER; - exit; - } - } + my ($label, $host, $command_opt, $type) = @_; + my $pid = fork; + warn ("[FugueConfig][WARNING] Could not fork $type \'$command_opt\'!\n"), return + unless defined $pid; + + # parent P1 + if ($pid) { + print "[FugueConfig][INFO] launch on $host $label $type \'$command_opt\' ". + "(pid=$pid)\n"; + return ($pid); + + # child P2 + } else { + + # overload parent trap + $SIG{INT} = 'DEFAULT'; + + # remote command + $command_opt = "$rsh -n $host '$command_opt'" + unless $host eq 'localhost' or $host eq hostname(); + + pipe(READER, WRITER); + WRITER->autoflush(1); + my $pid2 = fork; + warn ("[FugueConfig][WARNING] Could not fork $type \'$command_opt\'!\n"), + return unless defined $pid2; + # parent P2 + if ($pid2) { + close READER; + CORE::open(STDOUT, ">&=WRITER") or + die "[FugueConfig][WARNING] Couldn't redirect STDOUT"; + exec "$command_opt 2>&1 " or + die "[1m[FugueConfig][WARNING] Couldn't launch $command_opt[m"; + # child P3 + } else { + close WRITER; + while(<READER>) { + chomp(); + print "[1m$label[m $_\n"; + } + close READER; + exit; + } + } } # end _launch |