debianmacno-cupsweb
Last change
on this file since 78eb866c was
78eb866c,
checked in by Jessica B. Hamrick <jhamrick@…>, 14 years ago
|
Added gbq, a queueing script for gutenbach
Updated control to require CUPS perl bindings
|
-
Property mode set to
100755
|
File size:
922 bytes
|
Line | |
---|
1 | #!/usr/bin/perl |
---|
2 | |
---|
3 | # Written by Jessica Hamrick (C) 2010 |
---|
4 | |
---|
5 | use strict; |
---|
6 | use warnings; |
---|
7 | |
---|
8 | use Net::CUPS; |
---|
9 | use Net::CUPS::Destination; |
---|
10 | |
---|
11 | my $usage = "Usage: gbq QUEUE\n"; |
---|
12 | |
---|
13 | my $q = $ARGV[0]; |
---|
14 | |
---|
15 | if (!$q) { |
---|
16 | print $usage; |
---|
17 | exit 1 |
---|
18 | } |
---|
19 | |
---|
20 | my $configpath = "$ENV{'HOME'}/.gutenbach/$q"; |
---|
21 | my ($host, $queue); |
---|
22 | |
---|
23 | if (-r $configpath) { |
---|
24 | local $/; |
---|
25 | my $fh; |
---|
26 | open $fh, $configpath; |
---|
27 | eval <$fh>; |
---|
28 | } |
---|
29 | |
---|
30 | my $cups = Net::CUPS->new(); |
---|
31 | $cups->setServer("$host"); |
---|
32 | my $printer = $cups->getDestination("$queue"); |
---|
33 | |
---|
34 | print "Queue listing for queue '$queue' on '$host'\n\n"; |
---|
35 | print "Job ID\t\tOwner\t\tFile\n"; |
---|
36 | print "-----------------------------------------------------------------\n"; |
---|
37 | |
---|
38 | my @jobs = $printer->getJobs(0, 0); |
---|
39 | my ($job_ref, $jobid); |
---|
40 | |
---|
41 | foreach $jobid(@jobs) |
---|
42 | { |
---|
43 | $job_ref = $printer->getJob($jobid); |
---|
44 | my $id = $job_ref->{'id'}; |
---|
45 | my $user = $job_ref->{'user'}; |
---|
46 | my $title = $job_ref->{'title'}; |
---|
47 | |
---|
48 | print "$id\t\t$user\t\t$title\n"; |
---|
49 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.