debianmacno-cupsweb
Last change
on this file since 423cc42 was
611bd26,
checked in by Jessica B. Hamrick <jhamrick@…>, 14 years ago
|
gbr and gbrm should use CUPS_SERVER instead of -h
|
-
Property mode set to
100755
|
File size:
673 bytes
|
Line | |
---|
1 | #!/usr/bin/perl |
---|
2 | |
---|
3 | # Written by Jessica Hamrick (C) 2010 |
---|
4 | |
---|
5 | use strict; |
---|
6 | use warnings; |
---|
7 | |
---|
8 | my $usage = "Usage: gbq QUEUE ID\n"; |
---|
9 | |
---|
10 | my $q = $ARGV[0]; |
---|
11 | my $id = $ARGV[1]; |
---|
12 | |
---|
13 | if (!$q or !$id) { |
---|
14 | print $usage; |
---|
15 | exit 1 |
---|
16 | } |
---|
17 | |
---|
18 | my $configpath = "$ENV{'HOME'}/.gutenbach/$q"; |
---|
19 | if (! -e $configpath) { |
---|
20 | print "Queue '$q' does not exist!\n"; |
---|
21 | exit 1; |
---|
22 | } |
---|
23 | |
---|
24 | my ($host, $queue); |
---|
25 | |
---|
26 | if (-r $configpath) { |
---|
27 | local $/; |
---|
28 | my $fh; |
---|
29 | open $fh, $configpath; |
---|
30 | eval <$fh>; |
---|
31 | } |
---|
32 | |
---|
33 | my @args; |
---|
34 | |
---|
35 | if ($id eq "all") { |
---|
36 | @args = ("CUPS_SERVER=$host", "cancel", "-a", "$queue"); |
---|
37 | } |
---|
38 | else { |
---|
39 | @args = ("CUPS_SERVER=$host", "cancel", "$id", "$queue"); |
---|
40 | } |
---|
41 | exec (@args) or die "Couldn't execute cancel command"; |
---|
Note: See
TracBrowser
for help on using the repository browser.