#!/usr/bin/perl
-# Batch EXecutor 3.0 -- Insert to Queue
+# Batch EXecutor -- Insert to Queue
# (c) 2011-2013 Martin Mares <mj@ucw.cz>
use strict;
sub usage() {
print <<AMEN ;
-Usage: bex add [<options>] [!]<machine-or-class> ...
+Usage: bex add [<options>] [!]<machine-or-group> ...
Options:
-a, --attach=<path> Attach a file or directory to the job
if (defined($given_body) || defined($given_execute) || defined($given_id) || defined($given_subject) || defined($given_template)) {
die "Parameters of a requeued job cannot be changed\n";
}
- my $fn = $queue->job_file($requeue_id);
- -f $fn or die "Job $requeue_id not known\n";
+ my $id = $queue->resolve_job_id($requeue_id);
+ my $fn = $queue->job_file($id);
$job = BEX::Job->new_from_file($fn);
} else {
# Create job template
if (!$given_go) {
$tmp_fn = $job->save;
my $orig_stat = stat($tmp_fn) or die;
- system "editor", $tmp_fn and die "Editor exited with an error, file kept as $tmp_fn\n";
+ system $BEX::Config::editor_command, $tmp_fn and die "Editor exited with an error, file kept as $tmp_fn\n";
my $new_stat = stat($tmp_fn) or die "File $tmp_fn disappeared under my hands: $!\n";
if ($new_stat->mtime <= $orig_stat->mtime && $new_stat->size == $orig_stat->size) {
unlink $tmp_fn;
$? and die "Cannot delete old attachment $adest\n";
$msg = "Updated attachment";
}
- system "/bin/cp", "-a", $asrc, $adest;
+ system "/bin/cp", "-aL", $asrc, $adest;
$? and die "Cannot copy attachment $asrc to $adest\n";
if (-d $asrc) {
print "$msg $base/...\n";