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.

2 Answers 2

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
2
  • Does the console instead of command works too? Dec 20, 2018 at 10:47
  • In the Job definition?
    – sgargel
    Dec 21, 2018 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
    }
...
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .