diff options
author | etienne | 2004-03-15 13:27:24 +0000 |
---|---|---|
committer | etienne | 2004-03-15 13:27:24 +0000 |
commit | 8cfc00b622680f6c7b653959be49fbd35e3af71b (patch) | |
tree | 30f677128fbf10d9d5187700e5ae3b23750ff1c2 | |
parent | 2102b47ff958dd95879304a5571fadceb842bd68 (diff) | |
download | ivylaunch-8cfc00b622680f6c7b653959be49fbd35e3af71b.zip ivylaunch-8cfc00b622680f6c7b653959be49fbd35e3af71b.tar.gz ivylaunch-8cfc00b622680f6c7b653959be49fbd35e3af71b.tar.bz2 ivylaunch-8cfc00b622680f6c7b653959be49fbd35e3af71b.tar.xz |
*** empty log message ***
-rw-r--r-- | FugueConfig.pm | 8 | ||||
-rwxr-xr-x | ivylaunch | 12 |
2 files changed, 13 insertions, 7 deletions
diff --git a/FugueConfig.pm b/FugueConfig.pm index 806e19d..b1391ff 100644 --- a/FugueConfig.pm +++ b/FugueConfig.pm @@ -118,10 +118,14 @@ sub launchAgent { # launch a given command (not an ivy agent) on a given host sub launchCommand { + my ($type, $host, $command, $options) = @_; my @options = @$options if ref($options) eq 'ARRAY'; my $command_opt = $command.' '.join(' ', @options); my $pid = fork; + warn ("*** FugueConfig::launchCommand WARNING: Could not fork!\n"), return + unless defined $pid; + if ($pid) { # parent print "*** FugueConfig::launchCommand INFO: $host: launching command ". @@ -141,7 +145,7 @@ sub launchCommand { } } - } # end launchCommand -1 + +1; @@ -113,11 +113,12 @@ print "$HEADER $appliname is being launched using bus $bus (pid=$$)...\n"; # Now execute commands and launch the necessary agents foreach my $app (@{$cmd{'begin'}}) { - FugueConfig::launchCommand ('begin', @$app); + my $pid = FugueConfig::launchCommand ('begin', @$app); + $child{$pid} = $app->[1]; } foreach my $app (@{$agent{'local'}}) { my $pid = FugueConfig::launchAgent(@$app); - $child{$pid} = $app; + $child{$pid} = $app->[0]; } # if after 5 seconds the "global" agents are not detected, launch them. @@ -143,7 +144,7 @@ sub Global { unless (grep { $name eq $_ } (keys(%ready))) { print ("$HEADER appli $name not found. Launching it.\n"); my $pid = FugueConfig::launchAgent(@$app); - $child{$pid} = $app; + $child{$pid} = $app->[0]; $n++; } } @@ -160,8 +161,9 @@ sub Child { if (my $pid = waitpid (-1, WNOHANG)) { return if $pid == -1; + return unless $child{$pid}; my $status = $? & 255; - print "$HEADER [1mWarning! $child{$pid}[0]". + print "$HEADER [1mWarning! $child{$pid}". " (pid=$pid) exited with status $status.[m\n"; delete $child{$pid}; } @@ -173,7 +175,7 @@ sub Terminate { # when this function is called on an ivy die message, # children don't terminate. must be explored... foreach (keys %child) { - print "$HEADER Stopping $child{$_}[0] (pid=$_)...\n"; + print "$HEADER Stopping $child{$_} (pid=$_)...\n"; kill 15, $_; } |