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