source: gutenbach-client/bin/gbrm @ 0deef9e

debianmacno-cupsweb
Last change on this file since 0deef9e was 0deef9e, checked in by Jessica B. Hamrick <jhamrick@…>, 14 years ago

Move binary files to root directory, so the package is no longer debian-native

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