X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXCron.pm;h=c88ad1d3142d413dd87cb41d2c12f855eecb57dd;hb=41beb204d8c619d5929f9b1368972885e1f49965;hp=5bb1242283d635e7f11b5161a7178b62950a088a;hpb=0a35942621158fae0bca29f3c70c63a97fc4e691;p=spider.git diff --git a/perl/DXCron.pm b/perl/DXCron.pm index 5bb12422..c88ad1d3 100644 --- a/perl/DXCron.pm +++ b/perl/DXCron.pm @@ -215,33 +215,16 @@ sub last_connect # disconnect a locally connected thing sub disconnect { - my $call = uc shift; - my $dxchan = DXChannel->get($call); - if ($dxchan) { - if ($dxchan->is_ak1a) { - $dxchan->send_now("D", DXProt::pc39($main::mycall, "$main::mycall DXCron")); - } else { - $dxchan->send_now('D', ""); - } - $dxchan->disconnect; - } + my $call = shift; + run_cmd("disconnect $call"); } # start a connect process off sub start_connect { - my $call = uc shift; - my $lccall = lc $call; - - 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('err', "Cannot find connect script for $lccall"); - } + my $call = shift; + # connecting is now done in one place - Yeah! + run_cmd("connect $call"); } # spawn any old job off @@ -255,14 +238,14 @@ sub spawn # in child, unset warnings, disable debugging and general clean up from us $^W = 0; eval "{ package DB; sub DB {} }"; - alarm(0); DXChannel::closeall(); for (@main::listeners) { $_->close_server; } - unless ($^O =~ /^MS/) { + unless ($main::is_win) { $SIG{HUP} = 'IGNORE'; $SIG{CHLD} = $SIG{TERM} = $SIG{INT} = $SIG{__WARN__} = 'DEFAULT'; + alarm(0); } exec "$line" or dbg('cron', "exec '$line' failed $!"); } @@ -288,5 +271,16 @@ sub rcmd # send it DXProt::addrcmd($DXProt::me, $call, $line); } + +sub run_cmd +{ + my $line = shift; + my @in = DXCommandmode::run_cmd($DXProt::me, $line); + dbg('cron', "cmd run: $line"); + for (@in) { + s/\s*$//og; + dbg('cron', "cmd out: $_"); + } +} 1; __END__