source: gutenbach-client/debian/bin/gbq @ 78eb866c

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
5use strict;
6use warnings;
7
8use Net::CUPS;
9use Net::CUPS::Destination;
10
11my $usage = "Usage: gbq QUEUE\n";
12
13my $q = $ARGV[0];
14
15if (!$q) {
16    print $usage;
17    exit 1
18}
19
20my $configpath = "$ENV{'HOME'}/.gutenbach/$q";
21my ($host, $queue);
22
23if (-r $configpath) {
24    local $/;
25    my $fh;
26    open $fh, $configpath;
27    eval <$fh>;
28}
29
30my $cups = Net::CUPS->new();
31$cups->setServer("$host");
32my $printer = $cups->getDestination("$queue");
33
34print "Queue listing for queue '$queue' on '$host'\n\n";
35print "Job ID\t\tOwner\t\tFile\n";
36print "-----------------------------------------------------------------\n";
37
38my @jobs = $printer->getJobs(0, 0);
39my ($job_ref, $jobid);
40
41foreach $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.