document xwc-jobs script and implement SEP custom separator
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 26 Feb 2019 08:38:04 +0000 (09:38 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 26 Feb 2019 08:38:04 +0000 (09:38 +0100)
README
xwc-jobs.pl

diff --git a/README b/README
index bbce74c..028cf8b 100644 (file)
--- a/README
+++ b/README
@@ -1,7 +1,28 @@
 Goal is to write replacement SafeQ using cups and samba
 
 For now, first goal is to support SafeQ terminal protocol so we can re-use devices not supported
-by vendor any more. We are targeting only Xerox devices which we have.
+by vendor any more. We are also annoyed by SafeQ "feature" which doesn't allow us to use scanning
+if Xerox runs out of toner. This is arbitrary limitation which cripples this setup for us.
 
-./debian-install.sh # will install required Debian packages
+
+./debian-install.sh            # will install required Debian packages
+
+
+We have old Xerox WorkCentre 5225 and 7232 machines (from 2008) and getting active jobs or
+history is supported by web interface which is scraped and javascript variables inside
+used to display info.
+
+./xwc-jobs.pl 10.60.3.35               # list active jobs on Xerox WorkCentre 5225 by scraping web
+./xwc-jobs.pl 10.60.3.35 list
+
+./xwc-jobs.pl 10.60.3.35 hist  # list completed jobs
+
+Script produces tab delimited output, but if you want to format it nicely you can always use
+SEP enviroment variable to specify sparator and column to format it:
+
+dpavlin@t42:~/safeq$ SEP=, ./xwc-jobs.pl 10.60.3.35 | column -s , -t
+IP          id        Job Name   Owner       Status         Type     Quantity
+10.60.3.35  00015c2c  -          10.60.3.10  3:User Action  1:Print  0
+10.60.3.35  00015c2f  Test Page  root        3:User Action  1:Print  0
+10.60.3.35  00015c32  -          10.60.3.10  3:User Action  1:Print  0
 
index 5245ab2..86ce4c9 100755 (executable)
@@ -6,7 +6,7 @@ use Data::Dump qw(dump);
 
 my $ip = shift @ARGV || '10.60.3.35';
 my $debug = $ENV{DEBUG} || 0;
-
+my $sep = $ENV{SEP} || "\t";
 
 my $op = shift @ARGV || 'list';
 
@@ -37,7 +37,7 @@ my @headers = @{ $info->{hdrs} };
 unshift @headers, 'id' if $op eq 'list';
 unshift @headers, 'IP';
 
-print join("\t", @headers),"\n";
+print join($sep, @headers),"\n";
 
 foreach my $l ( @{ $info->{info} } ) {
        warn "## l=",dump($l) if $debug > 1;
@@ -45,7 +45,7 @@ foreach my $l ( @{ $info->{info} } ) {
        $l->[3] .= ':' . $info->{stats}->[ $l->[3] ];
        $l->[4] .= ':' . $info->{types}->[ $l->[4] ];
 
-       print join("\t", $ip, @$l), "\n";
+       print join($sep, $ip, @$l), "\n";
 }
 
 foreach my $l ( @{ $info->{jHst} } ) {
@@ -54,5 +54,5 @@ foreach my $l ( @{ $info->{jHst} } ) {
        $l->[2] .= ':' . $info->{stsAry}->[ $l->[2] ];
        $l->[3] .= ':' . $info->{types}->[ $l->[3] ];
 
-       print join("\t", $ip, @$l),"\n";
+       print join($sep, $ip, @$l),"\n";
 }