0

Edit #1

From the docs:

Only a single type (Backup, Restore, ...) can be specified for any job. If you want to backup multiple FileSets on the same Client or multiple Clients, you must define a Job for each one.

I am guessing the answer is "no" to this question. FML


I created some Bacula FileSets like below to include in a Bacula Job. I need to run the same job on six different hosts (clients), but I don't have a clue on how to do it.

So, I set up some FileSets, like below:

# Wildfly FileSet
FileSet {
  Name = "Wildfly"
  Include {
    Options {
      signature = MD5
      compression = GZIP
    }
    File = /opt/wildfly/
  }
}
# Scripts, Crontabs and Configuration files FileSet
FileSet {
  Name = "Scripts Crontabs e Conf"
  Include {
    Options {
      signature = MD5
      compression = GZIP
    }
    File = /usr/local/scripts/
    File = /var/spool/cron/crontabs/
    File = /etc
  }
  Exclude {
    File = /etc/ssl/
    File = /etc/ldap/
  }
}

And then I created a job:

Job {
  Name = "BackupMyHostName"
  JobDefs = "DefaultJob"
  Client = MyHostName-fd
  Pool = MyBackupPolicy
  FileSet="Wildfly"
}

It's gonna be complicated if I have to copy and paste the same code six times for each different fileset. I have 40 (forty) more servers ahead.

I'm new to Bacula, but it's been a week already and only now I am able to grasp some of the definitions of the system.

I need a kind push on the right direction for this task.

Community
  • 1
  • 1

1 Answers1

1

As you guessed, Bacula support a single FileSet and a single Client in a single Job. Your different jobs can share a the same single FileSet, Pool or Schedule configurations, which simplify it. Additionally you can setup a job templates: JobDefs which you can use to simplify multiple copy-paste job configurations. So, lets assume you have a single FileSet which you want to use in the multiple jobs for multiple clients. First some example configurations:

Fileset:

# Scripts, Crontabs and Configuration files FileSet
FileSet {
  Name = "Scripts Crontabs e Conf"
  Include {
    Options {
      signature = MD5
      compression = GZIP
    }
    File = /usr/local/scripts/
    File = /var/spool/cron/crontabs/
    File = /etc
  }
  Exclude {
    File = /etc/ssl/
    File = /etc/ldap/
  }
}

Clients:

Client {
  Name = client1
  Address = client1.example.com
}
Client {
  Name = client2
  Address = client2.example.com
}

then a template JobDefs:

JobDefs {
  Name = JD
  Type = Backup
  Priority = 10
  Messages = "Standard"
  WriteBootstrap = "/opt/bacula/bsr/%c-%n.bsr"
  Storage = bacula-sd
  FileSet = "Scripts Crontabs e Conf"
}

so, in this case you can create the jobs as simple as:

Job {
  Name = job1
  JobDefs = JD
  Client = client1
}
Job {
  Name = job2
  JobDefs = JD
  Client = client2
}

Thats all. I hope it helps.

radekk
  • 41
  • 4
  • This will help me for sure. Thank you! I was understimating the power of JobDefs in Bacula. Templating like this helps to keep my code organized. –  Feb 28 '19 at 17:31