-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQUEST.kill.queued.pl
More file actions
38 lines (31 loc) · 841 Bytes
/
QUEST.kill.queued.pl
File metadata and controls
38 lines (31 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/perl
# -d
use strict;
use warnings;
use Data::Dumper;
# This script kill all jobs found in the queue list
my $quest_outlist = qx/QUEST.client.pl -l/;
my @splitted_out = split("\n", $quest_outlist);
my $start;
my @joblist;
foreach my $newline (@splitted_out) {
next unless ($newline);
if ($start) {
if ($newline =~ /^\[/) {
my ($jobid) = $newline =~ /^\[([\w\d]{8})\]/;
push(@joblist, $jobid);
} elsif ($newline =~ /^--$/) {
last;
}
} elsif ($newline =~ /^--- JOB QUEUED ---/) {
$start = 1;
next;
}
}
# inverto la lista, visto che il primo job in coda è quello che più probabilmente va in run
@joblist = reverse @joblist;
while (my $tokill = shift @joblist) {
my $log = qx/QUEST.client.pl -k $tokill/;
print $log;
}
exit;