Start Manual Individual Copy Job or at the End of Backups

It is possible to run a Bacula Copy Job for a specific JobID, through the command:

run job=xx jobid=yy yes

In this case, xx should be the name of your Copy Job with the settings, for example, of Type=Copy, Pool and NextPool.

Also, you may want to start an individual Bacula Copy Job automatically at the end of the original Backup Job, rather than scheduling a routine with a fixed time.

This can be done by configuring a small Shell Script on the Director’s machine, replacing <JOB_COPIA> with the name of the Copy Job to be executed:

#!/bin/bash
# Exemplo: /opt/bacula/scripts/run_copy_job.sh

( sleep 10; echo "run job="<JOB_COPIA>" jobid=$1 pool=$2 yes" \
| /opt/bacula/bin/bconsole ) \
>/dev/null < /dev/null &

The script can be called for a configured Backup Job, for example:

Job {
  Name = Original_Backup_Job
...
 RunScript {
  RunsOnClient = No
  Command = "/opt/bacula/scripts/run_copy_job.sh %i %p"
  RunsWhen = After
 }
}

Or for all configured Jobs in the Director that use the same JobDefs:

JobDefs {
  Name = "DefaultJob"
  Type = "Backup"
  ...
  Runscript {
   Command = "/opt/bacula/scripts/run_copy_job.sh %i %p"
   RunsOnClient = no
   RunsWhen = After
  }
  ...
}

 

Disponível em: pt-brPortuguês (Portuguese (Brazil))enEnglishesEspañol (Spanish)

Leave a Reply