1

When a Bacula backup job fails, is it possible to run a different backup job ?

I mean something like "after failure of Job A, run Job B".

Is there a specific directive in the Job Resource?

EDIT1: I tryed the directive Run After Failed Job = command which can be used for running a script like echo "run job=my_job yes" | bconsole but seems that the script doesn't nothing.

1

I achieved my goal with this Job Resource directive:

Job {
...
    RunScript {
        Command = "/etc/bacula/scripts/run_my_job"
        RunsWhen = After
        RunsOnFailure = yes
        RunsOnClient  = no
        RunsOnSuccess = no
    }
...
}

/etc/bacula/scripts/run_my_job needs to be chmod +x

/etc/bacula/scripts/run_my_job content is:

#!/bin/sh
echo "run job=my_job yes" | bconsole
  • Does the console instead of command works too? – MUY Belgium Dec 20 '18 at 10:47
  • In the Job definition? – sgargel Dec 21 '18 at 11:41
1

In the Job definition,

replace

    Command = "/etc/bacula/scripts/run_my_job"

by

    Console = "run job=my_job yes"

No log is visible in the output of the job, because it is placed on job N°0 (not checked), but the command will be executed.

Job {
...
    RunScript {
        Console = "run job=my_job yes"
        RunsWhen = After
        RunsOnFailure = yes
        RunsOnClient  = no
        RunsOnSuccess = no
    }
...
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.