X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXCron.pm;h=5bb1242283d635e7f11b5161a7178b62950a088a;hb=4a8336156c820698be4933a3e36513750709926d;hp=c0565fa1e9e8268b2c3c8aed8719398227f91409;hpb=97315924f561c56cef3b581691409d4217f5c1b5;p=spider.git diff --git a/perl/DXCron.pm b/perl/DXCron.pm index c0565fa1..5bb12422 100644 --- a/perl/DXCron.pm +++ b/perl/DXCron.pm @@ -13,7 +13,6 @@ use DXUtil; use DXM; use DXDebug; use IO::File; -use Carp; use strict; @@ -234,28 +233,15 @@ sub start_connect my $call = uc shift; my $lccall = lc $call; - my $prog = "$main::root/local/client.pl"; - $prog = "$main::root/perl/client.pl" if ! -e $prog; - - my $pid = fork(); - if (defined $pid) { - if (!$pid) { - # in child, unset warnings, disable debugging and general clean up from us - $^W = 0; - eval "{ package DB; sub DB {} }"; - $SIG{HUP} = 'IGNORE'; - alarm(0); - DXChannel::closeall(); - $SIG{CHLD} = $SIG{TERM} = $SIG{INT} = $SIG{__WARN__} = 'DEFAULT'; - exec $prog, $call, 'connect' or dbg('cron', "exec '$prog' failed $!"); - } - dbg('cron', "connect to $call started"); + if (Msg->conns($call)) { + dbg('cron', "Connect not started, outstanding connect to $call"); + return; + } + if (-e "$main::root/connect/$lccall") { + ExtMsg::start_connect($call, "$main::root/connect/$lccall"); } else { - dbg('cron', "can't fork for $prog $!"); + dbg('err', "Cannot find connect script for $lccall"); } - - # coordinate - sleep(1); } # spawn any old job off @@ -269,10 +255,15 @@ sub spawn # in child, unset warnings, disable debugging and general clean up from us $^W = 0; eval "{ package DB; sub DB {} }"; - $SIG{HUP} = 'IGNORE'; alarm(0); DXChannel::closeall(); - $SIG{CHLD} = $SIG{TERM} = $SIG{INT} = $SIG{__WARN__} = 'DEFAULT'; + for (@main::listeners) { + $_->close_server; + } + unless ($^O =~ /^MS/) { + $SIG{HUP} = 'IGNORE'; + $SIG{CHLD} = $SIG{TERM} = $SIG{INT} = $SIG{__WARN__} = 'DEFAULT'; + } exec "$line" or dbg('cron', "exec '$line' failed $!"); } dbg('cron', "spawn of $line started"); @@ -295,7 +286,7 @@ sub rcmd return if !$noderef || !$noderef->pcversion; # send it - DXProt::addrcmd($main::mycall, $call, $line); + DXProt::addrcmd($DXProt::me, $call, $line); } 1; __END__