- Detector of orphans (unused queue dirs, jobs on non-existent machines, non-queued jobs)
- job failed => give a more explanatory message
- write_job_status should be atomic
-- bq --show
--- /dev/null
+#!/usr/bin/perl
+# Batch EXecutor 2.0 -- Operations on a Job
+# (c) 2011 Martin Mares <mj@ucw.cz>
+
+use strict;
+use warnings;
+use Getopt::Long;
+
+use lib 'lib';
+use BEX;
+
+my $edit;
+my $queue_name;
+
+GetOptions(
+ "e|edit!" => \$edit,
+ "q|queue=s" => \$queue_name,
+) && @ARGV == 1 or die <<AMEN ;
+Usage: bjob [<options>] <job-id>
+
+Options:
+-e, --edit Run editor on the given job (no locking)
+-q, --queue=<name> Act on the given queue
+AMEN
+
+my $queue = BEX::Queue->new($queue_name);
+my $fn = $queue->job_file($ARGV[0]);
+-f $fn or die "No such job " . $ARGV[0] . "\n";
+
+if ($edit) {
+ system "editor", $fn;
+} else {
+ system "cat", $fn;
+}