]> mj.ucw.cz Git - bex.git/blobdiff - lib/bin/bex-add
Maint: Reorganization of my directory structure
[bex.git] / lib / bin / bex-add
index 4f2c3b39138822594dac031e807c298db4637814..7138ef5046bc38b5677347786efe58ed700f642d 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
 #!/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;
 # (c) 2011-2013 Martin Mares <mj@ucw.cz>
 
 use strict;
@@ -21,7 +21,7 @@ my @attach = ();
 
 sub usage() {
        print <<AMEN ;
 
 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
 
 Options:
 -a, --attach=<path>    Attach a file or directory to the job
@@ -70,8 +70,8 @@ if (defined $requeue_id) {
        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";
        }
        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
        $job = BEX::Job->new_from_file($fn);
 } else {
        # Create job template
@@ -95,7 +95,7 @@ if (defined $requeue_id) {
        if (!$given_go) {
                $tmp_fn = $job->save;
                my $orig_stat = stat($tmp_fn) or die;
        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;
                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;
@@ -123,7 +123,7 @@ if (@attach) {
                        $? and die "Cannot delete old attachment $adest\n";
                        $msg = "Updated attachment";
                }
                        $? 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";
                $? and die "Cannot copy attachment $asrc to $adest\n";
                if (-d $asrc) {
                        print "$msg $base/...\n";