and new cron commands: spawn_cmd which will background any dxspider cmd
sub handle
{
my ($self, $line) = @_;
+
+ $DB::single = 1;
# create the arg list
my %want;
return (1, "MRTG not installed") unless $want{nomrtg} || -e '/usr/bin/mrtg' || -e '/usr/local/bin/mrtg';
- my @out = $self->spawn_cmd("mrtg $line", \&do_it, args=>[%want]);
+ my @out = do_it(%want);
return (1, @out);
}
);
}
+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
{