projects
/
safeq
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
097f49f
)
added s[tatus] to scrape stgen.htm
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Tue, 26 Feb 2019 16:49:32 +0000
(17:49 +0100)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Tue, 26 Feb 2019 16:49:32 +0000
(17:49 +0100)
xwc-jobs.pl
patch
|
blob
|
history
diff --git
a/xwc-jobs.pl
b/xwc-jobs.pl
index
69c3d72
..
d3eb07a
100755
(executable)
--- a/
xwc-jobs.pl
+++ b/
xwc-jobs.pl
@@
-10,11
+10,18
@@
my $sep = $ENV{SEP} || "\t";
my $op = shift @ARGV || 'list';
my $op = shift @ARGV || 'list';
-my $url = 'jblist.htm';
+my $url;
+my $var_re;
+
if ( $op =~ m/^l/i ) { # list
$url = 'jblist.htm';
if ( $op =~ m/^l/i ) { # list
$url = 'jblist.htm';
+ $var_re = '(stats|types|info|hdrs)';
} elsif ( $op =~ m/^h/i ) { # history
$url = 'jbhist.htm';
} elsif ( $op =~ m/^h/i ) { # history
$url = 'jbhist.htm';
+ $var_re = '(hdrs|stsAry|types|jHst)';
+} elsif ( $op =~ m/^s/i ) { # status
+ $url = 'stgen.htm';
+ $var_re = '(lbls|spcs|adrslbl)';
} elsif ( $op =~ m/^(d|c)/i ) { # delete/cancel
my $job_id = join('/', @ARGV) || die "expected job_id(s) missing";
open(my $curl, '-|', "curl --silent -XPOST -d OPR=CANCEL -d JOBS=$job_id/ http://$ip/JOBCTRL.cmd");
} elsif ( $op =~ m/^(d|c)/i ) { # delete/cancel
my $job_id = join('/', @ARGV) || die "expected job_id(s) missing";
open(my $curl, '-|', "curl --silent -XPOST -d OPR=CANCEL -d JOBS=$job_id/ http://$ip/JOBCTRL.cmd");
@@
-34,16
+41,31
@@
warn "# $ip/$url" if $debug;
open(my $curl, '-|', "curl --silent http://$ip/$url");
my $info;
while(<$curl>) {
open(my $curl, '-|', "curl --silent http://$ip/$url");
my $info;
while(<$curl>) {
- if ( m/var (stats|types|info|hdrs|stsAry|jHst)=(.*);/ ) {
+ if ( m/var ${var_re}=(.*);/ ) {
+ my $name = $1;
my $json = $2;
my $v = eval $json; # this is not valid JSON, but perl's eval doesn't mind
my $json = $2;
my $v = eval $json; # this is not valid JSON, but perl's eval doesn't mind
-
#warn "# JSON $json -> ",dump($v)
;
+
warn "## JSON $name $json -> ",dump($v) if $debug > 1
;
$info->{$1} = $v;
}
}
warn "# info=",dump($info) if $debug;
$info->{$1} = $v;
}
}
warn "# info=",dump($info) if $debug;
+if ( exists $info->{spcs} ) {
+ print join($sep, @{ $info->{lbls} }),"\n";
+
+ my @s = @{ $info->{spcs} };
+ foreach my $i ( 0 .. $#{ $s[1] } ) {
+ $s[1]->[$i] .= ' ' . $info->{adrslbl}->[$i];
+ }
+ $s[1] = join(',', @{ $s[1] });
+
+ print join($sep, @s),"\n";
+
+ exit 0;
+}
+
my @headers = @{ $info->{hdrs} };
unshift @headers, 'id' if $op eq 'list';
unshift @headers, 'IP';
my @headers = @{ $info->{hdrs} };
unshift @headers, 'id' if $op eq 'list';
unshift @headers, 'IP';