X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXCron.pm;h=757ec61cd640756b6b6d7587c1e62f06143e81bc;hb=812bf47870fa01eccce9d08c8a053659b8ddc6a1;hp=f9a4f07ea12585ab62b30389b1c4734d341fa2eb;hpb=12041dbf48c9a02a60c44b665227e185bc5590a4;p=spider.git diff --git a/perl/DXCron.pm b/perl/DXCron.pm index f9a4f07e..757ec61c 100644 --- a/perl/DXCron.pm +++ b/perl/DXCron.pm @@ -263,6 +263,29 @@ sub spawn ); } +sub spawn_cmd +{ + my $line = shift; + + dbg("spawn_cmd run: $line") if isdbg('cron'); + my $fc = Mojo::IOLoop::ForkCall->new; + $fc->run( + sub {my @res = DXCommandmode::run_cmd($main::me, $line); return @res}, + [], + sub { + my ($fc, $err, @res) = @_; + if (defined $err) { + my $s = "spawn_cmd: error $err"; + dbg($s); + } + for (@res) { + chomp; + dbg("spawn_cmd: $_") if isdbg("cron"); + } + } + ); +} + # do an rcmd to another cluster from the crontab sub rcmd {