summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoretienne2004-03-15 13:27:24 +0000
committeretienne2004-03-15 13:27:24 +0000
commit8cfc00b622680f6c7b653959be49fbd35e3af71b (patch)
tree30f677128fbf10d9d5187700e5ae3b23750ff1c2
parent2102b47ff958dd95879304a5571fadceb842bd68 (diff)
downloadivylaunch-8cfc00b622680f6c7b653959be49fbd35e3af71b.zip
ivylaunch-8cfc00b622680f6c7b653959be49fbd35e3af71b.tar.gz
ivylaunch-8cfc00b622680f6c7b653959be49fbd35e3af71b.tar.bz2
ivylaunch-8cfc00b622680f6c7b653959be49fbd35e3af71b.tar.xz
*** empty log message ***
-rw-r--r--FugueConfig.pm8
-rwxr-xr-xivylaunch12
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;
diff --git a/ivylaunch b/ivylaunch
index 667ea5c..e726012 100755
--- a/ivylaunch
+++ b/ivylaunch
@@ -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 Warning! $child{$pid}[0]".
+ print "$HEADER Warning! $child{$pid}".
" (pid=$pid) exited with status $status.\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, $_;
}