summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
601ea9f)
and new cron commands: spawn_cmd which will background any dxspider cmd
sub handle
{
my ($self, $line) = @_;
sub handle
{
my ($self, $line) = @_;
# create the arg list
my %want;
# create the arg list
my %want;
return (1, "MRTG not installed") unless $want{nomrtg} || -e '/usr/bin/mrtg' || -e '/usr/local/bin/mrtg';
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);
+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
{
# do an rcmd to another cluster from the crontab
sub rcmd
{