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.

sgargel
  • 190
  • 1
  • 15

2 Answers2

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
sgargel
  • 190
  • 1
  • 15
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
    }
...
}
MUY Belgium
  • 235
  • 3
  • 17