From: Dirk Koopman Date: Fri, 7 Aug 2020 15:20:28 +0000 (+0100) Subject: add uptime cmd, add bells to sh/data X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=140683d04c00f7932b7e3ee7f7bde4513915f0c9;p=spider.git add uptime cmd, add bells to sh/data --- diff --git a/cmd/show/cluster.pl b/cmd/show/cluster.pl index 7ebfb946..d61eaa84 100644 --- a/cmd/show/cluster.pl +++ b/cmd/show/cluster.pl @@ -8,5 +8,6 @@ my ($nodes, $tot, $users, $maxlocalusers, $maxusers, $uptime, $localnodes) = Rou $localnodes = $main::routeroot->nodes; $users = $main::routeroot->users; +$uptime = difft($main::starttime, ' '); return (1, $self->msg('cluster', $localnodes, $nodes, $users, $tot, $maxlocalusers, $maxusers, $uptime)); diff --git a/cmd/show/data_stats.pl b/cmd/show/data_stats.pl index 7b37da06..ecd50d77 100644 --- a/cmd/show/data_stats.pl +++ b/cmd/show/data_stats.pl @@ -9,23 +9,38 @@ sub handle { my ($self, $line) = @_; - my @list = map { uc } split /\s+/, $line; # list of callsigns of nodes + my @in = map { uc } split /\s+/, $line; # list of callsigns of nodes my @out; - if ($list[0] eq 'ALL') { - shift @list; + my @list; + + if ($in[0] eq 'ALL') { @list = keys %DXChannel::channels; + } else { + while (@in) { + my $in = shift @in; + if ($in =~ /^NOD/){ + push @list, DXChannel::get_all_node_calls(); + } elsif ($in =~ /^USE/) { + push @list, DXChannel::get_all_user_calls(); + } elsif ($in =~ /^RBN|SKI/) { + push @list, map {$_->is_rbn ? $_->call : undef} DXChannel::get_all(); + } else { + push @list, $in; + } + } } - push @out, "Data Statitics IN OUT"; + + my $dt = difft($main::starttime, ' '); + push @out, sprintf "Transfered in:%-12.12s IN OUT", $dt; push @out, "Callsign Lines Data Lines Data"; push @out, "-----------------------------------------------------------------------------"; - if (@list) { - foreach my $call (sort @list) { - next if $call eq $main::mycall; - my $dxchan = DXChannel::get($call); - if ($dxchan) { - my $conn = $dxchan->conn; - push @out, sprintf("%-9.9s %16s %16s %16s %16s", $call, comma($conn->{linesin}), comma($conn->{datain}), comma($conn->{linesout}), comma($conn->{dataout})); - } + push @list, $self->call unless @list; + foreach my $call (sort @list) { + next if $call eq $main::mycall; + my $dxchan = DXChannel::get($call); + if ($dxchan) { + my $conn = $dxchan->conn; + push @out, sprintf("%-9.9s %16s %16s %16s %16s", $call, comma($conn->{linesin}), comma($conn->{datain}), comma($conn->{linesout}), comma($conn->{dataout})); } } diff --git a/cmd/uptime.pl b/cmd/uptime.pl new file mode 100644 index 00000000..484cb4cf --- /dev/null +++ b/cmd/uptime.pl @@ -0,0 +1,6 @@ +# +# do a tradiotional "uptime" clone +# +my $self = shift; + +return (1, sprintf("%s $main::mycall uptime: %s", ztime(), difft($main::starttime, ' ')));