
#include "bacula_template.inc" title="Director Configuration" num=6.1

<h1>Configuring the Director</h1>
Of all the configuration files needed to run <b>Bacula</b>, the
Director's is the most complicated, and the one that you
will need to modify the most often as you add clients or modify
the FileSets.
<p>For a general discussion of configuration file and resources
including the data types recognized by <b>Bacula</b>. Please
see the <a href="configure.html">Configuration</a> chapter of this
manual.

<h2>Director Resource Types</h2>
Director resource type may be one of the following:
<p class="tty">Job, JobDefs, Client, Storage, Catalog, Schedule, FileSet, Pool, Director,
             or Messages.</p>

We present them here in the most logical order
for defining them:     
<ul> 
  <li><a href="#DirectorResource">Director</a> -- to
      define the Director's name and its access password used for
      authenticating the Console program. Only a single
      Director resource definition may appear in the Director's
      configuration file.  
      If you have either <b>/dev/random</b>     
      <b>bc</b> on your machine, Bacula will generate a random 
      password during the configuration process, otherwise it will
      be left blank. </li>
  <li><a href="#JobResource">Job</a> -- to define the backup/restore Jobs
      and to tie together the Client, FileSet and Schedule resources to
      be used for each Job.</li>
  <li><a href="#JobDefsResource">JobDefs</a> -- optional resource for  
      providing defaults for Job resources.</li>
  <li><a href="#ScheduleResource">Schedule</a> -- to define when a Job is to
       be automatically run by <b>Bacula's</b> internal scheduler.</li> 
  <li><a href="#FileSetResource">FileSet</a> -- to define the set of files
      to be backed up for each Client.  </li>
  <li><a href="#ClientResource">Client</a> -- to define what Client is
      to be backed up.</li> 
  <li><a href="#StorageResource">Storage</a> -- to define on what
       physical device the Volumes should be mounted.  </li>
  <li><a href="dirdconf.html#PoolResource">Pool</a> -- to define what
      the pool of Volumes that can be used for a particular Job.  </li>
  <li><a href="#CatalogResource">Catalog</a> -- to define in what database to
      keep the list of files and the Volume names where they are backed up.
      </li>
  <li><a href="messagesres.html">Messages</a> -- to define where error
      and information messages are to be sent or logged.  </li>
</ul>


<h1><a name="DirectorResource">The Director Resource</a></h1>
The Director resource defines the attributes of the Directors running on
the network. In the current implementation, there is only a single Director
resource, but the final design will contain multiple Directors to maintain
index and media database redundancy. 
<dl>
<dt>Director</dt><dd>Start of the Director records. One and only one
    director resource must be supplied.</dd>
    </dd>
<dt>Name = &lt;name&gt;</dt><dd>The director name used by the system
     administrator. This record is required.
     </dd>
<dt>Description = &lt;text&gt;</dt><dd>The text field contains a
    description of the Director that will be displayed in the
    graphical user interface. This record is optional.
    </dd>
<dt>Password = &lt;UA-password&gt;</dt><dd>Specifies the password that
    must be supplied for the default Bacula Console to be authorized.  The same
    password must appear in the <b>Director</b> resource of the Console
    configuration file.  For added security, the password is never
    actually passed across the network but rather a challenge response
    hash code created with the password.  This record is required.
    If you have either <b>/dev/random</b> <b>bc</b> on your machine,
    Bacula will generate a random password during the configuration
    process, otherwise it will be left blank and you must manually
    supply it.
    </dd>
<dt>Messages = &lt;Messages-resource-name&gt;</dt><dd>The messages resource
   specifies where to deliver Director messages that are not associated
   with a specific Job. Most messages are specific to a job and will
   be directed to the Messages resource specified by the job. However,
   there are a few messages that can occur when no job is running.
   This record is required.
   </dd>
<dt>Working Directory = &lt;Directory&gt;</dt><dd>This directive
   is mandatory and specifies a directory in which the Director 
   may put its status files. This directory should be used only
   by Bacula but may be shared by other Bacula daemons.
   Standard shell expansion of the <b>Directory</b>
   is done when the configuration file is read so that values such
   as <b>$HOME</b> will be properly expanded. This record is required.
   </dd>
<dt>Pid Directory = &lt;Directory&gt;</dt><dd>This directive
   is mandatory and specifies a directory in which the Director 
   may put its process Id file files. The process Id file is used to 
   shutdown Bacula and to prevent multiple copies of
   Bacula from running simultaneously.
   Standard shell expansion of the <b>Directory</b>
   is done when the configuration file is read so that values such
   as <b>$HOME</b> will be properly expanded. 
   <p>Typically on Linux systems, you will set this to:  
   <b>/var/run</b>. If you are not installing Bacula in the
   system directories, you can use the <b>Working Directory</b> as
   defined above. 
   This record is required. 
   </dd>

<dt>QueryFile = &lt;Path&gt;</dt><dd>This directive
   is mandatory and specifies a directory and file in which the Director
   can find the canned SQL statements for the <b>Query</b> command of
   the Console.  Standard shell expansion of the <b>Path</b> is done
   when the configuration file is read so that values such as
   <b>$HOME</b> will be properly expanded.  This record is required.
   </dd>

<a name="DirMaxConJobs"></a>
<dt>Maximum Concurrent Jobs = &lt;number&gt;</dt><dd>where &lt;number&gt;
   is the maximum number of total Director Jobs that should run
   concurrently.  The default is set to 1, but you may set it to a
   larger number.  Note however, at this time (Bacula version 1.32f-3),
   multiple simultaneous jobs seem to work fine, but this feature has not
   been heavily tested in production.
   <p>Because this feature is not yet well tested, we recommend that you
   make careful tests to ensure that everything you want works.  Please
   note that the Volume format becomes much more complicated with
   multiple simultaneous jobs, consequently, restores can take much
   longer if Bacula must sort through interleaved volume blocks from
   multiple simultaneous jobs.  There may also still be some cases where
   directives such as <b>Maximum Volume Jobs</b> are not properly
   synchronized with multiple simultaneous jobs (subtle timing issues
   can arise).
   <p>At the current time, there is no configuration parameter   
   set or limit the number console connections. A maximum of five
   simultaneous console connections are permitted.
   <p>
   Note that <b>Maximum Concurrent Jobs</b> is implemented in the
   Director, Job, Client, and Storage resources. Each one is independent
   of the others, and all limits from each of those resources must
   be met before a Job can run.  There should be no problems increasing
   the <b>Maximum Concurrent Jobs</b> in the Director, Client, and
   Job resources. 
   </dd>

<dt>FD Connect Timeout = &lt;time&gt;</dt><dd> where <b>time</b> 
   is the time that the Director should continue attempting
   to contact the File daemon to start a job, and after which the
   Director will cancel the job. The default is 30 minutes.</dd>

<dt>SD Connect Timeout = &lt;time&gt;</dt><dd> where <b>time</b> 
   is the time that the Director should continue attempting
   to contact the Storage daemon to start a job, and after which the
   Director will cancel the job. The default is 30 minutes.</dd>

<dt>DIRport = &lt;port-number&gt;</dt><dd>Specify the port (a positive
   integer) on which the
   Director daemon will listen for Bacula Console connections.
   This same port number must be specified in the Director resource
   of the Console configuration file. The default is 9101, so
   normally this record need not be specified. </dd>

<dt>DirAddress = &lt;IP-Address&gt;</dt><dd>This record is optional,
   but if it is specified, it will cause the Director server (for
   the Console program) to bind to the specified <b>IP-Address</b>,
   which is either a domain name or an IP address specified as a
   dotted quadruple in string or quoted string format.  
   If this record is not specified, the Director
   will bind to any available address (the default). </dd>
</dl>

<p>
The following is an example of a valid Director resource definition:
<pre>
Director {
  Name = HeadMan
  WorkingDirectory = "$HOME/bacula/bin/working"
  Password = UA_password
  PidDirectory = "$HOME/bacula/bin/working"
  QueryFile = "$HOME/bacula/bin/query.sql"
  Messages = Standard
}
</pre>

<h1><a name="JobResource">The Job Resource</a></h1>
The Job resource defines a Job (Backup, Restore, ...) that Bacula must
perform.  Each Job resource definition contains the names
of the Clients and their FileSets to backup or restore, 
the Schedule for the Job, where the data are to be stored, 
and what media Pool can be used.  In effect, each Job resource
must specify What, Where, How, and When or FileSet, Storage, 
Backup/Restore/Level, and Schedule respectively.
<p>Only a single type (<b>Backup</b>, <b>Restore</b>, ...) 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. 

<dl>
<dt>Job</dt><dd>Start of the Job records. At least one Job
    resource is required. </dd>

<dt>Name = &lt;name&gt;</dt><dd>The Job name.  This name can be specified
    on the <b>Run</b> command in the console program to start a job. If the
    name contains spaces, it must be specified between quotes. It is
    generally a good idea to give your job the same name as the Client
    that it will backup. This permits easy identification of jobs.
    <p>When the job actually runs, the unique Job Name will consist     
    of the name you specify here followed by the date and time the
    job was scheduled for execution. This record is required. </dd>

<dt>Type = &lt;job-type&gt;</dt><dd>The <b>Type</b> record specifies
    the Job type, which may be one of the following: <b>Backup</b>,
    <b>Restore</b>, <b>Verify</b>, or <b>Admin</b>. This record
    is required. Within a particular Job Type, there are also Levels
    as discussed in the next item.
    <dl>
      <dt>Backup</dt><dd>Run a backup Job. Normally you will 
          have at least one Backup job for each client you want
          to save. Normally, unless you turn off cataloging, 
          most all the important statistics and data concerning
          files backed up will be placed in the catalog. </dd>
      <dt>Restore</dt><dd>Run a restore Job. Normally, you will 
          specify only one Restore job which acts as a sort
          of prototype that you will modify using the console 
          program in order to perform restores. Although certain
          basic information from a Restore job is saved in the
          catalog, it is very minimal compared to the information
          stored for a Backup job -- for example, no File records
          are generated since no Files are saved.</dd>
      <dt>Verify</dt><dd>Run a verify Job. In general, <b>verify</b>
          jobs permit you to compare the contents of the catalog
          to the file system, or to what was backed up. In addition,
          to verifying that a tape that was written can be read,
          you can also use <b>verify</b> as a sort of tripwire
          intrusion detection.</dd>
      <dt>Admin</dt><dd>Run a admin Job. An <b>Admin</b> job can
         be used to periodically run catalog pruning, if you
         do not want to do it at the end of each <b>Backup</b>
         Job. Although an Admin job is recorded in the
         catalog, very little data is saved. </dd>
       </dl>
      
<a name="Level"></a>
<dt>Level = &lt;job-level&gt;</dt><dd>The Level record specifies
    the default Job level to be run. Each different
    Job Type (Backup, Restore, ...) has a different set of Levels
    that can be specified. The Level is normally  overridden
    by a different value that is specified in the <b>Schedule</b>
    resource. This record is not required, but must be specified either
    by a <b>Level</b> record or as a override specified in the
    <b>Schedule</b> resource.
    <p>For a <b>Backup</b> Job, the Level may be one of the
    following:
   <dl>
    <dt>Full</dt><dd>is all files in the FileSet whether or not they
        have changed.</dd>
    <dt>Incremental</dt><dd>is all files that have changed since the
        last successful backup of the specified FileSet.  If the
        Director cannot find a previous Full backup then the job will be
        upgraded into a Full backup.  When the Director looks for a
        &quot;suitable&quot; backup record in the catalog database, it
        looks for a previous Job with:
        <ul>
        <li>The same Job name.</li>
        <li>The same Client name.</li>
        <li>The same FileSet (any change to the definition of
            the FileSet such as adding or deleting a file in the
            Include or Exclude sections constitutes a different FileSet.</li>
         <li>The Job was a Full, Differential, or Incremental backup.</li>
         <li>The Job terminated normally (i.e. did not fail or was not 
             canceled).</li>
         </ul>
         <p>
         If all the above conditions do not hold, the Director will upgrade
         the Incremental to a Full save.  Otherwise, the Incremental
         backup will be performed as requested.  

         <p>The File daemon (Client) decides which files to backup for an
         Incremental backup by comparing start time of the prior Job
         (Full, Differential, or Incremental) against the time each file
         was last &quot;modified&quot; (st_mtime) and the time its
         attributes were last &quot;changed&quot (st_ctime).  If the
         file was modified or its attributes changed on or after this
         start time, it will then be backed up. 
         <p>Please note that some
         virus scanning software may change st_ctime while doing the
         scan.  For exaple, if the the virus scanning program attempts
         to reset the access time (st_atime), which Bacula does not use,
         it will cause st_ctime to change and hence Bacula will backup
         the file during an Incremental or Differential backup.  In the
         case of Sophos virus scanning, you can prevent it from
         resetting the access time (st_atime) and hence changing
         st_ctime by using the <b>--no-reset-atime</b> option.  For
         other software, please see their manual.</dd>

    <dt>Differential</dt><dd>is all files that have changed since the
        last successful Full backup of the specified FileSet.
        If the Director cannot find a previous Full backup or a
        suitable Full backup, then the Differential job will be
        upgraded into a Full backup.  When the Director looks for
        a &quot;suitable&quot; Full backup record in the catalog 
        database, it looks for a previous Job with:
        <ul>
        <li>The same Job name.</li>
        <li>The same Client name.</li>
        <li>The same FileSet (any change to the definition of
            the FileSet such as adding or deleting a file in the
            Include or Exclude sections constitutes a different FileSet.</li>
        <li>The Job was a FULL backup.</li>
        <li>The Job terminated normally (i.e. did not fail or was not 
             canceled).</li>
        </ul>
         <p>
        If all the above conditions do not hold, the Director will
        upgrade the Differential to a Full save.  Otherwise, the
        Differential backup will be performed as requested.  

        <p>The File daemon (Client) decides which files to backup for a
        differential backup by comparing the start time of the prior
        Full backup Job against the time each file was last
        &quot;modified&quot; (st_mtime) and the time its attributes were
        last &quot;changed&quot (st_ctime).  If the file was modified or
        its attributs were changed on or after this start time, it will
        then be backed up.  The start time used is displayed after the
        <b>Since</b> on the Job report.  In rare cases, using the start
        time of the prior backup may cause some files to be backed up
        twice, but it ensures that no change is missed.  As with the
        Incremental option, you shouldensure that the clocks on your
        server and client are synchronized or as close as possible to
        avoid the possibility of a file being skipped.  Note, on
        versions 1.33 or greater Bacula automatically makes the
        necessary adjstments to the time between the server and the
        client so that the times Bacula uses are synchronized.  </dd>


<!-- begin comment 
    <dt>*Since date</dt><dd>is all files that have changed since the
         date specified.</dd>

   -- end comment -->

   </dl>

   <dl>
     <p>For a <b>Restore</b> Job, no level need be specified.
   </dl>

   <dl>
    <p>For a <b>Verify</b> Job, the Level may be one of the 
    following:
    <dt>InitCatalog</dt><dd>does a scan of the specified <b>FileSet</b>
        and stores the file attributes in the Catalog database.  
        Since no file data is saved, you might ask why you would want to
        do this.  It turns out to be a very simple and easy way to have
        a <b>Tripwire</b> like feature using <b>Bacula</b>.  In other
        words, it allows you to save the state of a set of files defined
        by the <b>FileSet</b> and later check to see if those files have
        been modified or deleted and if any new files have been added.
        This can be used to detect system intrusion.  Typically you
        would specify a <b>FileSet</b> that contains the set of system
        files that should not change (e.g.  /sbin, /boot, /lib, /bin,
        ...).  Normally, you run the <b>InitCatalog</b> level verify one
        time when your system is first setup, and then once again after
        each modification (upgrade) to your system.  Thereafter, when
        your want to check the state of your system files, you use
        a <b>Verify</b> <b>level = Catalog</b>. This compares the results of
        your <b>InitCatalog</b> with the current state of the files.
        <dd>

    <dt>Catalog</dt><dd>Compares the current state of the files against
        the state previously saved during an <b>InitCatalog</b>.  Any
        discrepancies are reported.  The items reported are determined
        by the <b>verify</b> options specified on the <b>Include</b>
        directive in the specified <b>FileSet</b> (see the
        <b>FileSet</b> resource below for more details).  Typically this
        command will be run once a day (or night) to check for any
        changes to your system files.           
        <p>Please note! If you run two Verify Catalog jobs on
        the same client at the same time, the results will   
        certainly be incorrect. This is because Verify Catalog 
        modifies the Catalog database while running in order to track new
        files.
       </dd>

    <dt>VolumeToCatalog</dt><dd>This level causes Bacula to read 
        the file attribute data written to the Volume from the last Job.
        The file attribute data are compared to the values saved in the
        Catalog database and any differences are reported.  This is
        similar to the <b>Catalog</b> level except that instead of
        comparing the disk file attributes to the catalog database, the
        attribute data written to the Volume is read and compared to the
        catalog database.  Although the attribute data including the
        signatures (MD5 or SHA1) are compared the actual file data is not
        compared (it is not in the catalog).  <p>Please note!  If you
        run two Verify VolumeToCatalog jobs on the same client at the
        same time, the results will certainly be incorrect.  This is
        because the Verify VolumeToCatalog modifies the Catalog database
        while running.  </dd>

    <dt>DiskToCatalog</dt><dd>This level causes Bacula to read the
        files as they currently are on disk, and to compare the
        current file attributes with the attributes saved in the
        catalog from the last backup for the job specified on
        the <b>VerifyJob</b> record. This level differs from the
        <b>Catalog</b> level described above by the fact that it
        compare not against a previous Verify job but against a
        previous backup. When you run this level, you must supply the
        verify options on your Include statements. Those options
        determine what attribute fields are compared.
        <p>This command can be very useful if you have disk problems 
        because it will compare the current state of your disk against
        the last successful backup, which may be several jobs.
        <p>Note, the current implementation (1.32c) does not
        identify files that have been deleted.
        </dd>


<!-- begin comment
    <dt>*Data</dt><dd>This level causes Bacula to rescan the last job run
        and to verify that the data written to the Volume(s) can be
        read and that it is the same as the contents of the disk.</dd>
     end comment -->

  </dl>

<dt>Verify Job = &lt;Job-Resource-Name&gt;</dt><dd>If you run
    a verify job without this record, the last job run will
    be compared with the catalog, which means that you must
    immediately follow a backup by a verify command. If you
    specify a <b>Verify Job</b> Bacula will find the last
    job with that name that ran. This permits you to run
    all your backups, then run Verify jobs on those that
    you wish to be verified (most often a <b>VolumeToCatalog</b>)
    so that the tape just written is re-read.</dd>

<dt>JobDefs = &lt;JobDefs-Resource-Name&gt;</dt><dd>If a JobDefs-Resource-Name
    is specified, all the values contained in the named JobDefs resource
    will be used as the defaults for the current Job. Any value that
    you explicitly define in the current Job resource, will override
    any defaults specified in the JobDefs resource. The use of this
    directive permits writing much more compact Job resources where the
    bulk of the directives are defined in one or more JobDefs. This 
    is particularly useful if you have many similar Jobs but with
    minor variations such as different Clients.</dd>

<dt>Bootstrap = &lt;bootstrap-file&gt;</dt><dd>The Bootstrap
    record specifies a bootstrap file that, if provided, will
    be used during <b>Restore</b> Jobs and is ignored in other
    Job types. The <b>bootstrap</b>
    file contains the list of tapes to be used in a restore
    Job as well as which files are to be restored. Specification
    of this record is optional, and
    if specified, it is used only for a restore job. In addition, 
    when running a Restore job from the console, this value can
    be changed. 
    <p>
    If you use the <b>Restore</b> command in the Console program,
    to start a restore job, the <b>bootstrap</b> 
    file will be created automatically from the files you
    select to be restored.
    <p>
    For additional details of the <b>bootstrap</b> file, please see    
    <a href="bootstrap.html">Restoring Files with the Bootstrap File</a>
    chapter of this manual.

<dt><a name="writebootstrap"></a> Write Bootstrap =
    &lt;bootstrap-file-specification&gt;</dt><dd>The
    <b>writebootstrap</b> record specifies a file name where
    Bacula will write a <b>bootstrap</b> file for each Backup job
    run.  Thus this record applies only to Backup Jobs.  If the Backup
    job is a Full save, Bacula will erase any current contents of
    the specified file before writing the bootstrap records.  If the Job
    is an Incremental save, Bacula will append the current
    bootstrap record to the end of the file.  <p>Using this feature,
    permits you to constantly have a bootstrap file that can recover the
    current state of your system.  Normally, the file specified should
    be a mounted drive on another machine, so that if your hard disk is
    lost, you will immediately have a bootstrap record available.  <p>If
    the <b>bootstrap-file-specification</b> begins with a vertical bar
    (|), Bacula will use the specification as the name of a program to
    which it will pipe the bootstrap record.  It could for example be a
    shell script that emails you the bootstrap record.  <p>For more
    details on using this file, please see the chapter entitled <a
    href="bootstrap.html">The Bootstrap File</a> of this manual.  </dd>
    

<dt>Client = &lt;client-resource-name&gt;</dt><dd>The Client record
    specifies the Client (File daemon) that will be used in the
    current Job. Only a single Client may be specified in any one Job.
    The Client runs on the machine to be backed up,
    and sends the requested files to the Storage daemon for backup,
    or receives them when restoring. For additional details, see the 
    <a href="dirdconf.html#ClientResource">Client Resource
    section</a> of this chapter. This record is required. </dd>

<dt>FileSet = &lt;FileSet-resource-name&gt;</dt><dd>The FileSet record
    specifies the FileSet that will be used in the
    current Job. The FileSet specifies which directories (or files)
    are to be backed up, and what options to use (e.g. compression, ...).
    Only a single FileSet resource may be specified in any one Job.
    For additional details, see the 
    <a href="dirdconf.html#FileSetResource">FileSet Resource
    section</a> of this chapter. This record is required.</dd>

<dt>Messages = &lt;messages-resource-name&gt;</dt><dd>The Messages record
    defines what Messages resource should be used for this job, and thus
    how and where the various messages are to be delivered.  For example,
    you can direct some messages to a log file, and others can be
    sent by email.  For additional details, see the 
    <a href="messagesres.html">Messages Resource</a> Chapter of this
    manual.  This record is required.  </dd>

<dt>Pool = &lt;pool-resource-name&gt;</dt><dd>The Pool record defines
    the pool of Volumes where your data can be backed up. Many Bacula
    installations will use only the <b>Default</b> pool. However, if
    you want to specify a different set of Volumes for different
    Clients or different Jobs, you will probably want to use Pools.
    For additional details, see the <a href="dirdconf.html#PoolResource">Pool 
    Resource section</a> of this chapter.  This resource is required.  </dd>

<dt>Full Backup Pool = &lt;pool-resource-name&gt;</dt>
   <dd>The <em>Full Backup Pool</em> specifies a Pool to be used for
   Full backups. It will override any Pool specification during a 
   Full backup. This resource is optional.</dd>

<dt>Differential Backup Pool = &lt;pool-resource-name&gt;</dt>
   <dd>The <em>Differential Backup Pool</em> specifies a Pool to be used for
   Differential backups. It will override any Pool specification during a 
   Differentia backup. This resource is optional.</dd>

<dt>Incremental Backup Pool = &lt;pool-resource-name&gt;</dt>
   <dd>The <em>Incremental Backup Pool</em> specifies a Pool to be used for
   Incremental backups. It will override any Pool specification during a 
   Incremental backup. This resource is optional.</dd>

<dt>Schedule = &lt;schedule-name&gt;</dt><dd>The Schedule record defines
   what schedule is to be used for the Job.  The schedule determines
   when the Job will be automatically started and what Job level (i.e.
   Full, Incremental, ...) is to be run.  This record is optional, and
   if left out, the Job can only be started manually.  For additional
   details, see the <a href="dirdconf.html#ScheduleResource">Schedule
   Resource Chapter</a> of this manual.
   If a Schedule resource is specified, the job will be run according to
   the schedule specified.  If no Schedule resource is specified for the
   Job, the job must be manually started using the Console program.
   Although you may specify only a single Schedule resource for any one
   job, the Schedule resource may contain multiple <b>Run</b> records,
   which allow you to run the Job at many different times, and each
   <b>run</b> record permits overriding the default Job Level Pool,
   Storage, and Messages resources.  This gives considerable flexibility
   in what can be done with a single Job.  </dd>

<dt>Storage = &lt;storage-resource-name&gt;</dt><dd>The Storage record
    defines the name of the storage services where you want to backup
    the FileSet data.  For additional details, see the <a
    href="dirdconf.html#StorageResource">Storage Resource Chapter</a> of this manual.
    This record is required.
    </dd>

<dt>Max Start Delay = &lt;time&gt;</dt><dd>The time specifies
    maximum delay between the scheduled time and the actual start
    time for the Job. For example, a job can be scheduled to run
    at 1:00am, but because other jobs are running, it may wait
    to run. If the delay is set to 3600 (one hour) and the job
    has not begun to run by 2:00am, the job will be canceled.
    This can be useful, for example, to prevent jobs from running
    during day time hours. The default is 0 which indicates
    no limit. </dd>

<dt>Max Run Time = &lt;time&gt;</dt><dd>The time specifies
    maximum allowed time that a job may run, counted from the when
    the job starts (<b>not</b> necessarily the same as when the job
    was scheduled). This directive is implemented only in version 1.33</dd>
    and later. </dd>

<dt>Max Wait Time = &lt;time&gt;</dt><dd>The time specifies
    maximum allowed time that a job may block waiting for a resource
    (such as waiting for a tape to be mounted, or waiting for the storage
    or file daemons to perform their duties), counted from the when
    the job starts (<b>not</b> necessarily the same as when the job
    was scheduled). This directive is implemented only in version 1.33
    and later. Note, the implementation is not yet complete, so
    this directive does not yet work correctly.</dd>

<dt>Prune Jobs = &lt;yes/no&gt;</dt><dd>Normally, pruning of Jobs
    from the Catalog is specified on a Client by Client basis in the
    Client resource with the <b>AutoPrune</b> record.  If this
    record is specified (not normally) and the value is <b>yes</b>, it
    will override the value specified in the Client resource.
    The default is <b>no</b>. </dd>

<dt>Prune Files = &lt;yes/no&gt;</dt><dd>Normally, pruning of Files
    from the Catalog is specified on a Client by Client basis in the
    Client resource with the <b>AutoPrune</b> record.  If this
    record is specified (not normally) and the value is <b>yes</b>, it
    will override the value specified in the Client resource.
    The default is <b>no</b>. </dd>

<dt>Prune Volumes = &lt;yes/no&gt;</dt><dd>Normally, pruning of Volumes
    from the Catalog is specified on a Client by Client basis in the
    Client resource with the <b>AutoPrune</b> record.  If this
    record is specified (not normally) and the value is <b>yes</b>, it
    will override the value specified in the Client resource.
    The default is <b>no</b>. </dd>

<dt>Run Before Job = &lt;command&gt;</dt><dd>The specified <b>command</b>
   is run as an external program prior to running the current Job.  Any
   output sent by the job to standard output will be included in the
   Bacula job report.  The command string must be a valid program name
   or name of a shell script.  This record is not required, but if it is
   defined, and if the exit code of the program run is non-zero, the
   current Bacula job will be canceled. In addition, the command string
   is parsed then feed to the execvp() function, which means that the  
   path will be searched to execute your specified command, but there
   is no shell interpretation, as a consequence, if you 
   complicated commands or want any shell features such as redirection
   or piping, you must call a shell script and do it inside
   that script.

   <p>
   Before submitting the specified command to the operating system,
   Bacula performs character substitution of the following
   characters:
   <pre>
    %% = %
    %c = Client's name
    %d = Director's name
    %i = JobId
    %e = Job Exit Status
    %j = Unique Job name
    %l = Job Level
    %n = Job name
    %t = Job type
    %v = Volume name
    </pre>
    As of version 1.30, Bacula checks the exit status of the RunBeforeJob
    program. If it is non-zero, the job will be error terminated.
    Lutz Kittler has pointed out that this can be a simple way to modify 
    your schedules during a holiday. For example, suppose that you normally
    do Full backups on Fridays, but Thursday and Friday are holidays. To avoid
    having to change tapes between Thursday and Friday when no one is in the
    office, you can create a RunBeforeJob that returns a non-zero status on
    Thursday and zero on all other days. That way, the Thursday job will not
    run, and on Friday the tape you insert on Wednesday before leaving will
    be used.
   <p><p></dd>

<dt>Run After Job = &lt;command&gt;</dt><dd>The specified <b>command</b>
   is run as an external program after the current job terminates. 
   This record is not required. The
   command string must be a valid program name or name of a shell script.
   If the exit code of the program run is non-zero, the current
   Bacula job will terminate in error.
   Before submitting the specified command to the operating system,
   Bacula performs character substitution as described above   
   for the <b>Run Before Job</b> record. 
   <p>An example of the use of this command is given in the 
   <a href="tips.html#JobNotification">Tips Chapter</a> of this manual.
   As of version 1.30, Bacula checks the exit status of the RunAfter
   program. If it is non-zero, the job will be terminated in error.   
   <p><p></dd>

<dt>Client Run Before Job = &lt;command&gt;</dt><dd>This command
   is the same as <b>Run Before Job</b> except that it is
   run on the client machine. The same restrictions apply to
   Unix systems as noted above for the <b>Run Before Job</b>. In 
   addition, for a Windows client on version 1.33 and above, please
   take careful note that you must ensure a correct path to your
   script, and the script or program can be a .com, .exe or a .bat
   file. However, if you specify a path, you must also specify
   the full extension. Unix like commands will not work unless you
   have installed and properly configured Cygwin in addition to
   and separately from Bacula. 
   <p>
   <b>Special Windows Considerations</b><br>
   The command can be anything that cmd.exe or command.com will
   recognize as a executable file.  Specifiying the executable's
   extention is optional, unless there is an ambiguity.  (i.e.
   ls.bat, ls.exe)
   <p>
   The System %Path% will be searched for the command.  (under
   the envrionment variable dialog you have have both System
   Environment and User Environment, we believe that only the
   System environment will be available to bacual-fd, if it is
   running as a service.)
   <p>
   System environment varaible can be called out using the %var%
   syntax and used as either part of the command name or
   arguments.
   <p>
   When specifiying a full path to an executable if the path or
   executable name contains whitespace or special characters they
   will need to be quoted.  Arguments containing whitespace or
   special characters will also have to be quoted.
<pre>
ClientRunBeforeJob = &quot;\&quot;C:/Program Files/Software 
     Vendor/Executable\&quot; /arg1 /arg2 \&quot;foo bar\&quot;&quot;
</pre>
   The special characters &amp;()[]{}^=;!'+,`~ will need to be quoted
   if part of a filename or argument.
   <p>
   If someone is logged in a blank "command" window running the
   commands will be present during the execution of the command.
   <p>

   <p>
   Some Suggestions from Phil Stracchino for running on Win32 machines
   with the native Win32 File daemon:
<ol>
  <li>You might want the ClientRunBeforeJob directive to specify a .bat file which
    runs the actual client-side commands, rather than trying to run (for
    example) regedit /e directly.</li>
  <li>The batch file should explicitly 'exit 0' on successful completion.</li>
  <li>The path to the batch file should be specified in Unix form:
  <p>
       ClientRunBeforeJob = &quot;c:/bacula/bin/systemstate.bat&quot;
  <p>
    rather than DOS/Windows form:
  <p>
  ClientRunBeforeJob = &quot;c:\bacula\bin\systemstate.bat&quot; INCORRECT</li>
</ol></dd>

<dt>Client Run After Job = &lt;command&gt;</dt><dd>This command
   is the same as <b>Run After Job</b> except that it is
   run on the client machine. Note, please see the notes above
   in <b>Client Run Before Job</b> concerning Windows clients.</dd>

<dt>Spool Data = &lt;yes/no&gt;</dt><dd>If this directive is set
   to <b>yes</b> (default no), the Storage daemon will be requested
   to spool the data for this Job to disk rather than write it
   directly to tape. Once all the data arrives or the spool file
   maximum sizes are reached, the data will be despooled and written
   to tape. When this directive is set to yes, the Spool Attributes
   is also automatically set to yes. Spooling data prevents tape
   shoe-shine (start and stop) during Incremental saves. This option
   should not be used if you are writing to a disk file.</dd>
                              
<dt>Spool Attributes = &lt;yes/no&gt;</dt><dd>The default is set to 
   <b>no</b>, which means that the File attributes are sent by the
   Storage daemon to the Director as they are stored on tape. However,
   if you want to avoid the possibility that database updates will
   slow down writing to the tape, you may want to set the value to
   <b>yes</b>, in which case the Storage daemon will buffer the
   File attributes and Storage coordinates to a temporary file
   in the Working Directory, then when writing the Job data to the tape is 
   completed, the attributes and storage coordinates will be
   sent to the Director. The default is <b>no</b>.</dd>

<dt>Where = &lt;directory&gt;</dt><dd>This record applies only
   to a Restore job and specifies a prefix to the directory name
   of all files being restored. This permits files to be restored
   in a different location from which they were saved. If <b>Where</b>
   is not specified or is set to backslash (<b>/</b>), the files
   will be restored to their original location.  By default, we
   have set <b>Where</b> in the example configuration files to be
   <b>/tmp/bacula-restores</b>. This is to prevent accidental overwriting
   of your files.

<dt>Replace = &lt;replace-option&gt;</dt><dd>This record applies only
   to a Restore job and specifies what happens when Bacula wants to
   restore a file or directory that already exists. You have the 
   following options for <b>replace-option</b>:
   <dl>
     <dt>always</dt><dd>when the file to be restored already exists,
        it is deleted then replaced by the copy backed up.</dd>
     <dt>ifnewer</dt><dd>if the backed up file (on tape) is newer than the
        existing file, the existing file is deleted and replaced by
        the back up.</dd>
     <dt>ifolder</dt>if the backed up file (on tape) is older than the
        existing file, the existing file is deleted and replaced by
        the back up.</dd>
     <dt>never</dt>if the backed up file already exists, Bacula skips
        restoring this file.</dd>
    </dl>
   
<dt>Prefix Links=&lt;yes/no&gt;</dt><dd>If a <b>Where</b> path prefix is 
    specified for a recovery job, apply it to absolute links as
    well. The default is <b>No</b>. When set to <b>Yes</b> then while
    restoring files to an alternate directory, any absolute soft links
    will also be modified to point to the new alternate directory.
    Normally this is what is desired -- i.e. everything is self 
    consistent. However, if you wish to later move the files to
    their original locations, all files linked with absolute names
    will be broken. </dd>

<dt>Maximum Concurrent Jobs = &lt;number&gt;</dt><dd>where &lt;number&gt;
   is the maximum number of Jobs from the current Job resource that
   can run concurrently. Note, this record limits only Jobs
   with the same name as the resource in which it appears. Any
   other restrictions on the maximum concurrent jobs such as in
   the Director, Client, or Storage resources will also apply in addition to
   the limit specified here. The
   default is set to 1, but you may set it to a larger number. 
   We strongly recommend that you read the WARNING documented under
   <a href="dirdconf.html#DirMaxConJobs">
   Maximum Concurrent Jobs</a> in the Director's resource.
   </dd>

<dt>Reschedule On Error = &lt;yes/no&gt;</dt><dd>If this record is enabled,
   and the job terminates in error, the job will be rescheduled as determined
   by the <b>Reschedule Interval</b> and <b>Reschedule Times</b> records.
   If you cancel the job, it will not be rescheduled.  The default is
   <b>no</b> (i.e. the job will not be rescheduled).
   <p>This specification can be useful for portables, laptops, or other
   machines that are not always connected to the network or switched on.
   </dd>

<dt>Reschedule Interval = &lt;time-specification&gt;</dt><dd>If you have
   specified <b>Reschedule On Error = yes</b> and the job terminates in
   error, it will be rescheduled after the interval of time specified
   by <b>time-specification</b>. See <a href="configure.html#Time">
   the time specification formats</a> in the Configure chapter for
   details of time specifications.  If no interval is specified, the
   job will not be rescheduled on error.</dd>

<dt>Reschedule Times = &lt;count&gt;</dt><dd>This record specifies the
   maximum number of times to reschedule the job. If it is set to zero
   (the default) the job will be rescheduled an indefinite number of times.
   </dd>

<a name="Priority"></a>
<dt>Priority = &lt;number&gt;</dt><dd>This record permits you
    to control the order in which your jobs run by specifying a positive
    non-zero number.  The higher the number, the lower the job priority.
    Assuming you are not running concurrent jobs, all queued jobs of
    priority 1 will run before queued jobs of priority 2 and so on,
    regardless of the original scheduling order.

    <p>The priority only affects waiting jobs that are queued to run, not jobs 
    that are already running. If one or more jobs of priority 2 are already 
    running, and a new job is scheduled with priority 1, the currently 
    running priority 2 jobs must complete before the priority 1 job is run.
    <p>
    The default priority is 10.
    <p>
    If you want to run concurrent jobs, which is not recommended, you should 
    keep these points in mind:
    <ul>
      <li>To run concurrent jobs, 
         you must set Maximum Concurrent Jobs = 2 in 5 or 6 distinct places:
         in bacula-dir.conf in the Director, the Job, the Client, the Storage
         resources; in bacula-fd in the FileDaemon (or Client) resource, 
         and in bacula-sd.conf in the Storage resource.  If any one
         is missing, it will throttle the jobs to one at a time.</li>

      <li>Bacula concurrently runs jobs of only one priority at a time. It will
         not simultaneously run a priority 1 and a priority 2 job.</li>

      <li>If Bacula is running a priority 2 job and a new priority 1
         job is scheduled, it will wait until the running priority 2 job
         terminates even if the Maximum Concurrent Jobs settings
         would otherwise allow two jobs to run simultaneously.</li>

      <li>Suppose that bacula is running a priority 2 job and new priority 1
         job is scheduled and queued waiting for the running priority
         2 job to terminate. If you then start a second priority 2 job,
         the waiting priority 1 job 
         will prevent the new priority 2 job from running concurrently
         with the running priority 2 job. 
         That is: as long as there is a higher priority job waiting to
         run, no new lower priority jobs will start even if
         the Maximum Concurrent Jobs settings would normally allow
         them to run. This ensures that higher priority jobs will
         be run as soon as possible. </li>
     </ul>
     <p>If you have several jobs of different priority, it is best
     not to start them at exactly the same time, because Bacula   
     must examine them one at a time. If by chance Bacula treats
     a lower priority first, then it will run before your high
     priority jobs. To avoid this, start any higher priority
     a few seconds before lower ones. This insures that Bacula
     will examine the jobs in the correct order, and that your
     priority scheme will be respected.
    </dd>
</dl>

<p>
The following is an example of a valid Job resource definition:
<pre>
Job {
  Name = "Minou"
  Type = Backup
  Level = Incremental                 # default
  Client = Minou 
  FileSet="Minou Full Set"
  Storage = DLTDrive
  Pool = Default
  Schedule = "MinouWeeklyCycle"
  Messages = Standard
}
</pre>

<h1><a name="JobDefsResource">The JobDefs Resource</a></h1>
The JobDefs resource permits all the same directives that can
appear in a Job resource. However, a JobDefs resource does not
create a Job, rather it can be referenced within a Job to provide
defaults for that Job. This permits you to concisely define several
nearly identical Jobs, each one referencing a JobDefs resource 
which contains the defaults. Only the changes from the defaults
need be mentioned in each Job.</dd>

<h1><a name="ScheduleResource"></a>The Schedule Resource</h1>
The Schedule resource provides a means of automatically scheduling
a Job as well as the ability to override the default Level, Pool,
Storage and Messages resources. If a Schedule resource is not referenced
in a Job, the Job may only be run manually.
In general, you specify an action to be taken and when.

<dl>
<dt>Schedule</dt><dd>Start of the Schedule records. No <b>Schedule</b>
    resource is required, but you will need at least one if you want
    Jobs to be automatically started.</dd>
<dt>Name = &lt;name&gt;</dt><dd>The name of the schedule being defined.
    The name record is required.</dd>
<dt>Run = &lt;Job-overrides&gt; &lt;Date-time-specification&gt;
    </dt><dd>The Run record defines when a Job is to be run,
    and what overrides if any to apply. You may specify multiple
    <b>run</b> records within a <b>Schedule</b> resource. If you
    do, they will all be applied (i.e. multiple schedules). If you
    have two <b>Run</b> records that start at the same time, two
    Jobs will start at the same time (well, within one second of
    each other).
    
    <p>The <b>Job-overrides</b> permit overriding the Level, the
    Storage, the Messages, and the Pool specifications
    provided in the Job resource. In addition, the
    FullPool, the IncrementalPool, and the
    DifferentialPool specifications permit overriding the
    Pool specification according to what backup Job Level is
    in effect.  
    <p>By the use of overrides, you 
    may customize a particular Job. For example, you may specify a
    Messages override for your Incremental backups that
    outputs messages to a log file, but for your weekly or monthly
    Full backups, you may send the output by email by using
    a different Messages override.
    <p><b>Job-overrides</b> are specified as:
    <b>keyword=value</b> where the keyword is Level, Storage,
    Messages, Pool, FullPool, DifferentialPool, or IncrementalPool, and
    the <b>value</b> is as defined on the respective record formats for
    the Job resource.  You may specify multiple <b>Job-overrides</b> on
    one <b>Run</b> record by separating them with one or more spaces or
    by separating them with a trailing comma.

    For example:
    <dl>
    <dt>Level=Full</dt><dd>is all files in the FileSet whether or not
        they have changed.

    <dt>Level=Incremental</dt><dd>is all files that have changed since
        the last backup.</dd>
    <dt>Pool=Weekly</dt><dd>specifies to use the Pool named <b>Weekly</b>.
    <dt>Storage=DLT_Drive</dt><dd>specifies to use <b>DLT_Drive</b> for
        the storage device.</dd>
    <dt>Messages=Verbose</dt><dd>specifies to use the <b>Verbose</b>
        message resource for the Job.</dd>
    <dt>FullPool=Full</dt><dd>specifies to use the Pool named <b>Full</b>
        if the job is a full backup, or is upgraded from another type
        to a full backup.</dd>
    <dt>DifferentialPool=Differential</dt><dd>specifies to use the Pool
        named <b>Differential</b> if the job is a differential
        backup.</dd>
    <dt>IncrementalPool=Incremental</dt><dd>specifies to use the Pool
        named <b>Incremental</b> if the job is an incremental
        backup.</dd>
    <dt>SpoolData=yes/no</dt><dd>tells Bacula to request the Storage
        daemon to spool data to a disk file before putting it on
        tape.</dd>
    </dl>

    <p><b>Date-time-specification</b> determines when the
    Job is to be run.  The specification is a repetition, and as
    a default Bacula is set to run a job at the beginning of the
    hour of every hour of every day of every week of every month
    of every year.  This is not normally what you want, so you
    must specify or limit when you want the job to run.  Any
    specification given is assumed to be repetitive in nature and
    will serve to override or limit the default repetition.  This
    is done by specifing masks or times for the hour, day of the
    month, day of the week, week of the month, week of the year,
    and month when you want the job to run.  By specifying one or
    more of the above, you can define a schedule to repeat at
    almost any frequency you want.

    <p>Basically, you must supply a <b>month</b>, <b>day</b>, <b>hour</b>, and
    <b>minute</b> the Job is to be run. Of these four items to be specified,
    <b>day</b> is special in that you may either specify a day of the month
    such as 1, 2, ... 31, or you may specify a day of the week such
    as Monday, Tuesday, ... Sunday. Finally, you may also specify a
    week qualifier to restrict the schedule to the first, second, third,
    fourth, or fifth week of the month.
    <p>
    For example, if you specify only a day of the week, such as <b>Tuesday</b>
    the Job will be run every hour of every Tuesday of every Month. That
    is the <b>month</b> and <b>hour</b> remain set to the defaults of
    every month and all hours.
    <p>
    Note, by default with no other specification, your job will run
    at the beginning of every hour. If you wish your job to run more than
    once in any given hour, you will need to specify multiple <b>run</b>
    specifications each with a different minute.

    <p>The date/time to run the Job can be specified in the following way
     in pseudo-BNF: <dd>
<pre>
&lt;void-keyword&gt;    = on
&lt;at-keyword&gt;      = at
&lt;week-keyword&gt;    = 1st | 2nd | 3rd | 4th | 5th | first |
                    second | third | forth | fifth
&lt;wday-keyword&gt;    = sun | mon | tue | wed | thu | fri | sat |
                    sunday | monday | tuesday | wednesday | 
                    thursday | friday
&lt;week-of-year-keyword&gt; = w00 | w01 | ... w52 | w53
&lt;month-keyword&gt;   = jan | feb | mar | apr | may | jun | jul |
                    aug | sep | oct | nov | dec | january |
                    february | ... | december
&lt;daily-keyword&gt;   = daily
&lt;weekly-keyword&gt;  = weekly
&lt;monthly-keyword&gt; = monthly
&lt;hourly-keyword&gt;  = hourly
&lt;digit&gt;           = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0
&lt;number&gt;          = &lt;digit&gt; | &lt;digit&gt;&lt;number&gt;
&lt;12hour&gt;          = 0 | 1 | 2 | ... 12
&lt;hour&gt;            = 0 | 1 | 2 | ... 23
&lt;minute&gt;          = 0 | 1 | 2 | ... 59
&lt;day&gt;             = 1 | 2 | ... 31
&lt;time&gt;            = &lt;hour&gt;:&lt;minute&gt; | 
                    &lt;12hour&gt;:&lt;minute&gt;am | 
                    &lt;12hour&gt;:&lt;minute&gt;pm
&lt;time-spec&gt;       = &lt;at-keyword&gt; &lt;time&gt; | 
                    &lt;hourly-keyword&gt;
&lt;date-keyword&gt;    = &lt;void-keyword&gt;  &lt;weekly-keyword&gt; 
&lt;day-range&gt;       = &lt;day&gt;-&lt;day&gt;
&lt;month-range&gt;     = &lt;month-keyword&gt;-&lt;month-keyword&gt;
&lt;wday-range&gt;      = &lt;wday-keyword&gt;-&lt;wday-keyword&gt;
&lt;range&gt;           = &lt;day-range&gt; | &lt;month-range&gt; | 
                          &lt;wday-range&gt;
&lt;date&gt;            = &lt;date-keyword&gt; | &lt;day&gt; | &lt;range&gt;                            
&lt;date-spec&gt;       = &lt;date&gt; | &lt;date-spec&gt;
&lt;day-spec&gt;        = &lt;day&gt; | &lt;wday-keyword&gt; | 
                    &lt;day-range&gt; | &lt;wday-range&gt; |
                    &lt;daily-keyword&gt;
&lt;day-spec&gt;        = &lt;day&gt; | &lt;wday-keyword&gt; |
                    &lt;week-keyword&gt; &lt;wday-keyword&gt;
&lt;month-spec&gt;      = &lt;month-keyword&gt; | &lt;month-range&gt; | 
                    &lt;monthly-keyword&gt;
&lt;date-time-spec&gt;  = &lt;month-spec&gt; &lt;day-spec&gt; &lt;time-spec&gt;

</pre></dd>
   </dl>
</dl>

Note, the Week of Year specification wnn follows the ISO standard definition
of the week of the year, where Week 1 is the week in which the first 
Thursday of the year occurs, or alternatively, the week which contains
the 4th of January. w00 for Bacula is the week that precedes that week (i.e.
has the first few days of the year if any occur before Thursday). w00 is
not defined by the ISO specification.


<p>
An example schedule resource that is named <b>WeeklyCycle</b> and runs a
job with level full each Sunday at 1:05am and an incremental job Monday
through Saturday at 1:05am is:
<pre>
Schedule {
  Name = "WeeklyCycle"
  Run = Level=Full sun at 1:05
  Run = Level=Incremental mon-sat at 1:05
}
</pre>
An example of a possible monthly cycle is as follows:
<pre>
Schedule {
  Name = "MonthlyCycle"
  Run = Level=Full Pool=Monthly 1st sun at 1:05
  Run = Level=Differential 2nd-5th sun at 1:05
  Run = Level=Incremental Pool=Daily mon-sat at 1:05
}
</pre>
The first of every month:
<pre>
Schedule {
  Name = "First"
  Run = Level=Full 1 at 1:05
  Run = Level=Incremental 2-31 at 1:05
}
</pre>

Every 10 minutes:
<pre>
Schedule {
  Name = "TenMinutes"
  Run = Level=Full hourly at 0:05
  Run = Level=Full hourly at 0:15
  Run = Level=Full hourly at 0:25
  Run = Level=Full hourly at 0:35
  Run = Level=Full hourly at 0:45
  Run = Level=Full hourly at 0:55
}
</pre>

<h2>Technical Notes on Schedules</h2>
Internally Bacula keeps a schedule as a bit mask. There are six
masks and a minute field to each schedule. The masks are
hour, day of the month (mday), month, day of the week (wday),
week of the month (wom), and week of the year (woy). The schedule is
initialized to have the bits of each of these masks set, which 
means that at the beginning of every hour, the job will run.
When you specify a month for the first time, the mask will be
cleared and the bit corresponding to your selected month will be
selected. If you specify a second month, the bit corresponding to
it will also be added to the mask. Thus when Bacula checks the
masks to see if the bits are set corresponding to the current time,
your job will run only in the two months you have set.  Likewise,
if you set a time (hour), the hour mask will be cleared, and the
hour you specify will be set in the bit mask and the minutes will
be stored in the minute field.
<p>
For any schedule you have defined, you can see how these bits
are set by doing a <b>show schedules</b> command in the Console program.
Please note that the bit mask is zero based, and Sunday is the
first day of the week (bit zero).
  
<h1><a name="FileSetResource">The FileSet Resource</a></h1>
The FileSet resource defines what files are to be included in a backup
job. At least one <b>FileSet</b> resource is required for each
backup Job.
It consists of a list of files or directories to be included, a
list of files or directories to be excluded and the various backup
options such as compression, encryption, and signatures that are to be
applied to each file.
<p>Any change to the list of the included files will cause Bacula
to automatically create a new FileSet (defined by the name and an
MD5 checksum of the Include contents). Each time a new FileSet is
created, Bacula will ensure that the first backup is always a 
Full save.

<dl>
<dt>FileSet</dt><dd>Start of the FileSet records. At least one <b>FileSet</b>
    resource must be defined.</dd>
<dt>Name = &lt;name&gt;</dt><dd>The name of the FileSet resource.
    This record is required. </dd>
<dt>Include &nbsp; { [ Options {&lt;file-options&gt;} ...] &lt;file-list&gt; } <br></dt><dd></dd>
<dt>Options &nbsp; { &lt;file-options&gt; } <br></dt><dd></dd>
<dt>Exclude &nbsp; { &lt;file-list&gt; }</dt><dd></dd>
<p> 
Please note, due to an apparent current limitation in the scan code
implementation, the <b>Options</b> and/or the <b>file-list</b> must
begin on the next line, such as in:
<pre>
Include {
  Options {
    xxx
  }
}
</pre>
rather than
<pre>
Include { Options { xxx } }     --- WRONG
</pre>
<p>
The Include resource may contain both one or more Options resources
as will as the list of files and/or directories to
be included in the backup job.  There can be any number of <b>Include</b>
resources within the FileSet, each having its own
set of <b>file-options</b> defined by one or more
Options resources.  The <b>file-list</b>
consists of one file or directory name per line.  Directory names should
be specified without a trailing slash.
<p>You should <b>always</b> specify
a full path for every directory and file that you list in the FileSet.
In addition, on Windows machines, you should <b>always</b> prefix the
directory or filename with the drive specification (e.g.  <b>c:/xxx</b>)
using Unix directory name separators (forward slash).
<p>
Bacula's default for processing directories is to recursively descend
in the directory saving all files and subdirectories. Bacula will not
by default cross file systems (or mount points in Unix parlance). This
means that if you specify the root partition (e.g. <b>/</b>), Bacula will
save only the root partition and not any of the other mounted 
file systems. Similarly on Windows systems, you must explicitly 
specify each of the drives you want saved (e.g. <b>c:/</b>  and <b>d:/</b> ...).
In addition, at least for Windows systems, you will most likely want
to enclose each specification within double quotes.
The <b>df</b> command on Unix systems will show you which 
mount points you must specify to save everything. See below for
an example. 
<p>
Take special care not to include a directory twice or Bacula
will backup the same files two times wasting a lot of space on
your archive device. Including a directory twice is very easy
to do. For example:
<pre>
  Include { 
    File = /
    File = /usr
    Options { 
      compression=GZIP  
    }
  }
</pre>
on a Unix system where /usr is a subdirectory (rather than a
mounted filesystem) will cause /usr to be backed up twice. In this
case, on Bacula versions prior to 1.32f-5-09Mar04 due to a bug, you will not 
be able to restore hard linked files that were backed up twice.
<p>
If you have used Bacula prior to version 1.34.3, you will note three
things: 1. There is no equal sign (=) after the include; 2. Each
filename (or directory) is preceded by a <b>File =</b>; and 3.
The options that previously appeared on the Include line are now
specified within their own Options resource.
<p>
The Options resource is optional, but when specified,
it will contain a list of <b>keyword=value</b>
options to be applied to the file-list.  Multiple Options resources
may be specified one after another. They will be
applied in the order they are entered until the one one matches.
The options are used to modify the default processing behavior of
the files included.  Since there can be multiple <b>Include</b>
sets, this permits effectively specifying the desired options
(compression, encryption, ...) on a file by file basis.  
An Options resource that does not contain a <b>wild</b>
directive (wild-card specification, see below) is assumed
to match any filename. The directives within an Options
resource may be one of the following:
<dl>
<dt>compression=GZIP</dt><dd>All files saved will be software
    compressed using the GNU ZIP compression format. The
    compression is done on a file by file basis by the File daemon.
    If there is a problem reading the tape in a 
    single record of a file, it will at most affect that file and none
    of the other files on the tape. Normally this option is <b>not</b> needed
    if you have a modern tape drive as the drive will do its own
    compression. However, compression is very important if you are writing
    your Volumes to a file, and it can also be helpful if you have a
    fast computer but a slow network.
    <p>
    Specifying <b>GZIP</b> uses the default compression level six  
    (i.e. <b>GZIP</b> is identical to <b>GZIP6</b>). If you
    want a different compression level (1 through 9), you can specify
    it by appending the level number with no intervening spaces
    to <b>GZIP</b>. Thus <b>compression=GZIP1</b> would give  minimum
    compression but the fastest algorithm, and <b>compression=GZIP9</b>
    would give the highest level of compression, but requires more
    computation. According to the GZIP documentation, compression levels
    greater than 6 generally give very little extra compression but are
    rather CPU intensive.


<dt>signature=MD5</dt><dd>An MD5 signature will be computed for all
      files saved. Adding this option generates about 5% extra overhead
      for each file saved. In addition to the additional CPU time,
      the MD5 signature adds 16 more bytes per file to your catalog.
      We strongly recommend that this option
      be specified as a default for all files.</dd>

<dt>signature=SHA1</dt><dd>An SHA1 signature will be computed for all
      The SHA1 algorithm is purported to be some
      what slower than the MD5 algorithm, but at the same time is
      significantly better from a cryptographic point of view (i.e.
      much fewer collisions, much lower probability of being hacked.)
      It adds four more bytes than the MD5 signature.
      We strongly recommend that either this option
      or MD5 be specified as a default for all files. Note, only
      one of the two options MD5 or SHA1 can be computed for any
      file. </dd>


<dt>verify=&lt;options&gt;</dt><dd>The options letters specified are used
   when running a <b>Verify Level=Catalog</b> job, and may be any
   combination of the following:
   <dl>
           <dt>i</dt><dd>compare the inodes</dd>
           <dt>p</dt><dd>compare the permission bits</dd>
           <dt>n</dt><dd>compare the number of links</dd>
           <dt>u</dt><dd>compare the user id</dd>
           <dt>g</dt><dd>compare the group id</dd>
           <dt>s</dt><dd>compare the size</dd>
           <dt>a</dt><dd>compare the access time</dd>
           <dt>m</dt><dd>compare the modification time (st_mtime)</dd>
           <dt>c</dt><dd>compare the change time (st_ctime)</dd>
           <dt>s</dt><dd>report file size decreases</dd>
           <dt>5</dt><dd>compare the MD5 signature</dd>
           <dt>1</dt><dd>compare the SHA1 signature</dd>
   </dl> 
   <p>
   <dd>A useful set of general options on the <b>Level=Catalog</b>
       verify is <b>pins5</b> i.e. compare permission bits, inodes, number
       of links, size, and MD5 changes.</dd>


<dt>onefs=yes/no</dt><dd>If set to <b>yes</b> (the default), <b>Bacula</b>
    will remain on a single file system. That is it will not backup
    file systems that are mounted on a subdirectory.
    In this case, you must explicitly list each file system you want saved.
    If you set this option to <b>no</b>, Bacula will backup
    all mounted file systems (i.e. traverse mount points) that
    are found within the <b>FileSet</b>. Thus if
    you have NFS or Samba file systems mounted on a directory included
    in your FileSet, they will also be backed up. Normally, it is
    preferable to set <b>onefs=yes</b> and to explicitly name
    each file system you want backed up.
    See the example below for more details. </dd>

<a name="portable"></a>
<dt>portable=yes/no</dt><dd>If set to <b>yes</b> (default is
    <b>no</b>), the Bacula File daemon will backup Win32 files
    in a portable format.  By default, this option is set to 
    <b>no</b>, which means that on Win32 systems, the data will
    be backed up using Windows API calls and on WinNT/2K/XP,
    the security and ownership data will be properly backed up
    (and restored), but the data format is not portable to other
    systems -- e.g. Unix, Win95/98/Me.  On Unix systems, this
    option is ignored, and unless you have a specific need to
    have portable backups, we recommend accept the default
    (<b>no</b>) so that the maximum information concerning
    your files is backed up.  </dd>

<dt>recurse=yes/no</dt><dd>If set to <b>yes</b> (the default),
    Bacula will recurse (or descend) into all subdirectories
    found unless the directory is explicitly excluded
    using an <b>exclude</b> definition. 
    If you set
    <b>recurse=no</b>, Bacula will save the subdirectory entries,
    but not descend into the subdirectories, and thus 
    will not save the contents of the subdirectories. Normally, you
    will want the default (<b>yes</b>).
    </dd>

<dt>sparse=yes/no</dt><dd>Enable special code that checks for sparse files
    such as created by ndbm. The default is <b>no</b>, so no checks
    are made for sparse files. You may specify <b>sparse=yes</b> even
    on files that are not sparse file. No harm will be done, but there
    will be a small additional overhead to check for buffers of
    all zero, and a small additional amount of space on the output
    archive will be used to save the seek address of each non-zero
    record read. 
    <p><b>Restrictions:</b> Bacula reads files in 32K buffers. 
    If the whole buffer is zero, it will be treated as a sparse
    block and not written to tape.  However, if any part of the buffer
    is non-zero, the whole buffer will be written to tape, possibly
    including some disk sectors (generally 4098 bytes) that are all
    zero. As a consequence, Bacula's detection of sparse blocks is in
    32K increments rather than the system block size. If anyone      
    considers this to be a real problem, please send in a request
    for change with the reason. The sparse code was first 
    implemented in version 1.27.
    <p>If you are not familiar with sparse files, an example is
    say a file where you wrote 512 bytes at address zero, then
    512 bytes at address 1 million. The operating system will
    allocate only two blocks, and the empty space or hole
    will have nothing allocated. However, when you read the
    sparse file and read the addresses where nothing was written,
    the OS will return all zeros as if the space were allocated,
    and if you backup such a file, a lot of space will be used
    to write zeros to the volume. Worse yet, when you restore
    the file, all the previously empty space will now be allocated
    using much more disk space. By turning on the <b>sparse</b>
    option, Bacula will specifically look for empty space in
    the file, and any empty space will not be written to the Volume,
    nor will it be restored. The price to pay for this is that
    Bacula must search each block it reads before writing it.
    On a slow system, this may be important. If you suspect
    you have sparse files, you should benchmark the difference 
    or set sparse for only those files that are really sparse. </dd>

<a name="readfifo"></a>
<dt>readfifo=yes/no</dt><dd>If enabled, tells the Client to
    read the data on a backup and write the data on a restore
    to any FIFO (pipe) that is explicitly mentioned
    in the FileSet. In this case, you must have a program already
    running that writes into the FIFO for a backup or reads
    from the FIFO on a restore. This can be accomplished with
    the <b>RunBeforeJob</b> record. If this is not the case,
    Bacula will hang indefinitely on reading/writing the FIFO.
    When this is not enabled (default), the Client simply
    saves the directory entry for the FIFO. </dd> 

<dt>mtimeonly=yes/no</dt><dd>If enabled, tells the Client that
    the selection of files during Incremental and Differential
    backups should based only on the st_mtime value in the stat()
    packet.  The default is <b>no</b> which means that the
    selection of files to be backed up will be based on both the
    st_mtime and the st_ctime values.  In general, it is not
    recommended to use this option. </dd>

<dt>keepatime=yes/no</dt><dd>The default is <b>no</b>. When 
    enabled, Bacula will reset the st_atime (access time) field
    of files that it backs up to their value prior to the 
    backup. This option is not generally recommended as there
    are very few programs that use st_atime, and the backup
    overhead is increased because of the additional system
    call necessary to reset the times. (I'm not sure this
    works on Win32).</dd>

<dt>wild=&lt;string&gt;</dt><dd>Specifies a wild-card string
    to be applied to the Files.  Note, if <b>Exclude</b> is
    not enabled, the wild-card will select which files are to
    be included. If <b>Exclude=yes</b> is specified, the wild-card
    will select which files are to be excluded. Multiple wild-card
    directives may be specified, and they will be applied in turn
    until the first one that matches.</dd>

<dt>exclude=yes/no</dt><dd>The default is <b>no</b>. When
    enabled, any selected files will be excluded from the
    backup.</dd>

<dt>aclsupport=yes/no</dt><dd>The default is <b>no</b>.
   If this option is set to yes, Bacula tries to backup the file
   and directory UNIX Access Control Lists (ACL) as
   defined in IEEE Std 1003.1e draft 17 and &quot;POSIX.1e&quot;
   (abandoned).  This feature is available on UNIX only and
   depends on the ACL library.  Bacula is compiled with ACL
   support if this library is installed on the system (shown in
   config.out).  While restoring the files Bacula will try to
   restore the ACLs, if there is no ACL support available on this
   system, Bacula restores the files and directories but not
   the ACL information.</dd>



    
<!-- ----------- begin comment ------------------
<dt>*noexec=yes/no</dt><dd>All executable files will be automatically
    excluded from being saved. The default is <b>no</b> i.e. all files
    including executable files are saved. (NOT YET IMPELEMENTED)</dd>

<dt>*nofollow=yes/no</dt><dd>Any symbolic link found will be saved, but
    the link will not be followed (default).  This is normally exactly what
    is desired because the file pointed to by the link will be
    also normally included in the save the same way the link was
    included. In some special cases, one might want to save just
    the contents of a directory and also include the contents
    of all links in that directory. This is possible by specifying
    <b>nofollow=no</b> (NOT YET IMPLEMENTED).</dd>

<dt>*nonfs=yes/no</dt><dd>Any file that resides on an NFS file system
    will not be saved. The default is <b>no</b> so that any
    NFS file system specified in the <b>include</b> list will be
    backed up. (NOT YET IMPLEMENTED)</dd>

<dt>*encryption=&lt;algorithm&gt;</dt><dd>All files saved will be
    encrypted using one of the following algorithms (NOT YET IMPLEMENTED):
        <dl>
           <dt>*AES</dt>
        </dl>      

 --------------- end comment ---------- -->

</dl>
<p>
<b>&lt;file-list&gt;</b> is a filename
and/or directory names specified with a <b>File =</b> directive.
To include names containing spaces, enclose the
name between double-quotes. 
<p>There are a number of special cases when specifying files or
directories in a <b>file-list</b>. They are:
<ul>
  <li>Any filename preceded by an at-sign (@) is assumed to be a
      filename containing a list of files, which is read when
      the configuration file is parsed during Director startup.
      Note, that the file is read on the Director's machine
      and not on the Client.
      </li>     
  <li>Any filename beginning with a vertical bar (|) is 
      assumed to be a program. This program will be executed 
      on the Director's machine at the time the Job starts (not
      when the Director reads the configuration file), and any output
      from that program will be assumed to be a list of files or
      directories, one per line, to be included.  This allows you to
      have a job that for example includes all the local partitions even
      if you change the partitioning by adding a disk. In general, you will
      need to prefix your command or commands with a <b>sh -c</b> so that
      they are invoked by a shell. This will not be the case if you are
      invoking a script as in the second example below. Also, you must
      take care to escape wild-cards and ensure that any spaces in your
      command are escaped as well. If you use a single quotes (') within
      a double quote (&quot;), Bacula will treat everything between
      the single quotes as one field so it will not be necessary to
      escape the spaces. In general, getting all the quotes and escapes
      correct is a real pain as you can see by the next example. As a 
      consequence, it is often easier to put everything in a file, and simply
      us the file name within Bacula. In that case the <b>sh -c</b> will 
      not be necessary providing the first line of the file is
      <b>#!/bin/sh</b>.
      <p>As an example:
<pre> 
Include {
   Options {
      signature = SHA1
   }
   File = &quot;|sh -c 'df -l | grep \&quot;^/dev/hd[ab]\&quot; | grep -v \&quot;.*/tmp\" \\
      | awk \&quot;{print \\$6}\&quot;'&quot;
}
</pre>
      will produce a list of all the local partitions on a RedHat Linux
      system.  Note, the above line was split, but should normally
      be written on one line.
      Quoting is a real problem because you must quote for Bacula
      which consists of preceding every \ and every &quot; with a \, and
      you must also quote for the shell command.  In the end, it is probably
      easier just to execute a small file with:
<pre>
Include { 
  Options {
    signature=MD5
  }
  File = "|my_partitions"
}
</pre>
      where my_partitions has:
<pre>
\#!/bin/sh
df -l | grep &quot;^/dev/hd[ab]&quot; | grep -v &quot;.*/tmp" \\
      | awk &quot;{print \$6}&quot;
</pre>
      <p>If the vertical bar (|) is preceded by a backslash as in \|,
      the program will be executed on the Client's machine instead
      of on the Director's machine -- (this is implemented but
      not tested, and very likely will not work on Windows). Please
      note that if the filename is given within quotes, you will need to
      use two slashes.</li>

   <li>Any file-list item preceded by a less-than sign (&lt;) will be taken
       to be a file.  This file will be read on the Director's machine
       at the time the Job starts, and the data will be assumed to be a
       list of directories or files, one per line, to be included.  This
       feature allows you to modify the external file and change what
       will be saved without stopping and restarting Bacula as would be
       necessary if using the @ modifier noted above.
       <p>If you precede the less-than sign (&lt;) with a backslash
       as in \&lt;, the file-list will be read on the Client machine
       instead of on the Director's machine (implemented but not
       tested).  Please note that if the filename is given within
       quotes, you will need to use two slashes.</li>

   <li>If you explicitly specify a block device such as <b>/dev/hda1</b>,
       then Bacula (starting with version 1.28) will assume that this
       is a raw partition to be backed up. In this case, you are strongly
       urged to specify a <b>sparse=yes</b> include option, otherwise, you
       will save the whole partition rather than just the actual data that
       the partition contains. For example:
<pre>
Include {
  Options { 
    signature=MD5 
    sparse=yes  
  }
  File = /dev/hd6
}
</pre>
       will backup the data in device /dev/hd6.
       <p>Ludovic Strappazon has pointed out that this feature can be
       used to backup a full Microsoft Windows disk. Simply boot into
       the system using a Linux Rescue disk, then load a statically
       linked Bacula as described in the <a href="rescue.html">
       Disaster Recovery Using Bacula</a> chapter of this manual. Then
       simply save the whole disk partition. In the case of a disaster, you
       can then restore the desired partition. </li>

   <li>If you explicitly specify a FIFO device name (created with mkfifo),
       and you add the option <b>readfifo=yes</b> as an option, Bacula
       will read the FIFO and back its data up to the Volume. For
       example:
<pre>
Include {
  Options { 
    signature=SHA1 
    readfifo=yes
  }
  File = /home/abc/fifo
}
</pre>
       if <b>/home/abc/fifo</b> is a fifo device, Bacula will open the
       fifo, read it, and store all data thus obtained on the Volume.
       Please note, you must have a process on the system that is 
       writing into the fifo, or Bacula will hang, and after one 
       minute of waiting, it will go on to the next file. The data
       read can be anything since Bacula treats it as a stream.
       <p>
       This feature can be an excellent way to do a &quot;hot&quot;
       backup of a very large database. You can use the <b>RunBeforeJob</b>
       to create the fifo and to start a program that dynamically reads
       your database and writes it to the fifo. Bacula will then write
       it to the Volume. 
       <p> During the restore operation, the inverse is
       true, after Bacula creates the fifo if there was any data stored
       with it (no need to explicitly list it or add any options), that
       data will be written back to the fifo. As a consequence, if
       any such FIFOs exist in the fileset to be restored, you must 
       ensure that there is a reader program or Bacula will block,
       and after one minute, Bacula will time out the write to the
       fifo and move on to the next file. </li>
</ul>
       
</dl>

The following is an example of a valid FileSet resource definition:
<pre>
FileSet {
  Name = "Full Set"
  Include {
    Options { 
      compression=GZIP 
      signature=SHA1 
       sparse=yes 
    }
    File = @/etc/backup.list
  }
  Include {
     Options {
        wild = *.o
        Exclude = yes
     }
     File = /root/myfile
     File = /usr/lib/another_file
  }
}
</pre>
Note, in the above example, all the files contained in /etc/backup.list
will be compressed with GZIP compression, an SHA1 signature will be
computed on the file's contents (its data), and sparse file handling
will apply.
<p>
The two files /root/myfile and
/usr/lib/another_file will also be saved but without any options, but
all files with the extension <b>.o</b> will be excluded
from the two files /root/myfile and /usr/lib/another_file.
<p>
Suppose you want to save everything except <b>/tmp</b> on your system.
Doing a <b>df</b> command, you get the following output:
<pre>
[kern@rufus k]$ df
Filesystem      1k-blocks      Used Available Use% Mounted on
/dev/hda5         5044156    439232   4348692  10% /
/dev/hda1           62193      4935     54047   9% /boot
/dev/hda9        20161172   5524660  13612372  29% /home
/dev/hda2           62217      6843     52161  12% /rescue
/dev/hda8         5044156     42548   4745376   1% /tmp
/dev/hda6         5044156   2613132   2174792  55% /usr
none               127708         0    127708   0% /dev/shm
//minimatou/c$   14099200   9895424   4203776  71% /mnt/mmatou
lmatou:/          1554264    215884   1258056  15% /mnt/matou
lmatou:/home      2478140   1589952    760072  68% /mnt/matou/home
lmatou:/usr       1981000   1199960    678628  64% /mnt/matou/usr
lpmatou:/          995116    484112    459596  52% /mnt/pmatou
lpmatou:/home    19222656   2787880  15458228  16% /mnt/pmatou/home
lpmatou:/usr      2478140   2038764    311260  87% /mnt/pmatou/usr
deuter:/          4806936     97684   4465064   3% /mnt/deuter
deuter:/home      4806904    280100   4282620   7% /mnt/deuter/home
deuter:/files    44133352  27652876  14238608  67% /mnt/deuter/files
</pre>
Now, if you specify only <b>/</b> in your Include list, Bacula will
only save the Filesystem <b>/dev/hda5</b>. To save all file 
systems except <b>/tmp</b> with out including any of the Samba or NFS
mounted systems, and explicitly excluding a /tmp, /proc, .journal, and
.autofsck, which you will not want to be saved and restored,
you can use the following:
<pre>
FileSet {
  Name = Include_example
  Include {
    Options {
       wild = /proc
       wild = /tmp
       wild = \.journal
       wild = \.autofsck
       exclude = yes
    }
    File = /
    File = /boot
    File = /home
    File = /rescue
    File = /usr
  }
}
</pre>
<p>Since /tmp is on its own filesystem and it was not explicitly
named in the Include list, it is not really needed in the
exclude list. It is better to list it in the Exclude list for
clarity, and in case the disks are changed so that it is no longer
in its own partition.
<p>
Please be aware that allowing Bacula to traverse or change
file systems can be <b>very</b> dangerous. For example, with
the following:
<pre>
FileSet {
  Name = "Bad example"
  Include {
    Options {
      onefs=no
    }
    File = /mnt/matou
  }
}
</pre>
you will be backing up an NFS mounted partition (<b>/mnt/matou</b>),
and since <b>onefs</b> is set to <b>no</b>, Bacula will
traverse file systems. However, if <b>/mnt/matou</b> has the
current machine's file systems mounted, as is often the case,
you will get yourself into a recursive loop and the backup will
never end.
<p>The following FileSet definition will backup a raw partition:
<pre>
FileSet {
  Name = "RawPartition"
  Include {
    Options { 
      sparse=yes  
    }
    File = /dev/hda2
  }
}
</pre>
Note, in backing up and restoring a raw partition, you should ensure
that no other process including the system is writing to that partition.
As a precaution, you are strongly urged to ensure that the raw partition
is not mounted or is mounted read-only. If necessary, this can be done using the 
<b>RunBeforeJob</b> record.


<a name="win32"></a>
<h2>Windows Considerations for FileSets</h2>
If you are entering Windows file names, the directory path may be
preceded by the drive and a colon (as in c:). However, the path
separators must be specified in Unix convention (i.e. forward 
slash (/)). If you wish to include a quote in a file name, precede
the quote with a backslash (\\).  For example you might
use the following for a Windows machine to backup the &quot;My Documents&quot;
directory:
<pre>
FileSet {
  Name = "Windows Set"
  Include {
    Options {
       wild = *.obj
       wild = *.exe
       exclude = yes
     }
     File = "c:/My Documents"
  }
}
</pre>
For exclude lists to work correctly on Windows, you must observe 
the following rules:
<ul>
  <li>Filenames are case sensitive, so you must use the correct case.</li>
  <li>To exclude a directory, you must not have a trailing slash on the
    directory name.</li>
  <li>If you have spaces in your filename, you must enclose the entire name
      in double-quote characters (&quot;). Trying to use a backslash before
      the space will not work.</li>
</ul>
Thanks to Thiago Lima for summarizing the above items for us.  If
you are having difficulties getting includes or excludes to work, you might
want to try using the <b>estimate job=xxx listing</b> command documented
in the <a href="console.html#estimate">Console chapter</a> of this manual.

<h3>Excluding Files and Directories</h3>
You may also include full filenames or directory names in addition
to using wild-cards and <b>Exclude=yes</b> in the Options resource as
specified above by simply including the files to be excluded in
an Exclude resource within the FileSet. For example:
<pre>
FileSet {
  Name = Exclusion_example
  Include {
    Options {
      Signature = SHA1
    }
    File = /
    File = /boot
    File = /home
    File = /rescue
    File = /usr
  }
  Exclude {
    File = /proc
    File = /tmp
    File = .journal
    File = .autofsck
  }

}
</pre>



<h2>A Windows Example FileSet</h2>
The following example was contributed by Phil Stracchino:
<pre>

This is my Windows 2000 fileset:

FileSet {
  Name = &quot;Windows 2000 Full Set&quot;
  Include {
    Options { 
       signature=MD5 
    File = c:/
  }
  Exclude {
\# Most of these files are excluded not because we don't want 
\#  them, but because Win2K won't allow them to be backed up 
\#  except via proprietary Win32 API calls.
      File = &quot;/Documents and Settings/*/Application Data/*/Profiles/*/*/
         Cache/*  File = &quot;
      File = &quot;/Documents and Settings/*/Local Settings/Application Data/
         Microsoft/Windows/[Uu][Ss][Rr][Cc][Ll][Aa][Ss][Ss].*  File = &quot;
      File = &quot;/Documents and Settings/*/[Nn][Tt][Uu][Ss][Ee][Rr].*&quot;
      File = &quot;/Documents and Settings/*/Cookies/*&quot;
      File = &quot;/Documents and Settings/*/Local Settings/History/*&quot;
      File = &quot;/Documents and Settings/*/Local Settings/
         Temporary Internet Files/*  File = &quot;
      File = &quot;/Documents and Settings/*/Local Settings/Temp/*&quot;
      File = &quot;/WINNT/CSC&quot;
      File = &quot;/WINNT/security/logs/scepol.log&quot;
      File = &quot;/WINNT/system32/config/*&quot;
      File = &quot;/WINNT/msdownld.tmp/*&quot;
      File = &quot;/WINNT/Internet Logs/*&quot;
      File = &quot;/WINNT/$Nt*Uninstall*&quot;
      File = &quot;/WINNT/Temp/*&quot;
      File = &quot;/temp/*&quot;
      File = &quot;/tmp/*&quot;
      File = &quot;/pagefile.sys&quot;
    }

}
</pre>
Note, the three line of the above Exclude were split to fit on the document
page, they should be written on a single line in real use.

<h1>The Old FileSet Resource</h1>
The old pre-version 1.34.3 FileSet Resource has been deprecated
but will still work. You are encouraged to convert to using the
new form since the old code will be eventually removed.
You can find the documentation of the old FileSet directives in
a special <a href="oldfileset.html">old FileSet chapter.</a>

<h2>Testing Your FileSet</h2>
If you wish to get an idea of what your FileSet will really
backup or if your exclusion rules will work correctly, you can
test it by using the <b>estimate</b> command in the Console 
program. See the <a href="console.html#estimate">estimate command</a>
in the Console chapter of this manual.


<h2>Windows NTFS Naming Considerations</h2>
NTFS filenames containing Unicode characters (i.e. &gt; 0xFF) cannot
be explicitly named at the moment. You must include such names by
naming a higher level directory or a drive letter that does
not contain Unicode characters.

<h1><a name="ClientResource">The Client Resource</a></h1>
The Client resource defines the attributes of the Clients that are served
by this Director; that is the machines that are to be backed up.
You will need one Client resource definition for each machine to
be backed up.
<dl>
  <dt>Client (or FileDaemon)</dt><dd>Start of the Client records.</dd>
  <dt>Name = &lt;name&gt;</dt><dd>The client name which will be used in the
      Job resource record or in the console run command.
      This record is required. 
      </dd>
  <dt>Address = &lt;address&gt;</dt><dd>Where the address is a host
      name, a fully qualified domain name, or a network address in
      dotted quad notation for a Bacula File server daemon.
      This record is required. </dd>
  <dt>FD Port = &lt;port-number&gt;</dt><dd>Where the port is a port
      number at which the Bacula File server daemon can be contacted.
      The default is 9102. </dd>
  <dt>Catalog = &lt;Catalog-resource-name&gt;</dt><dd>This specifies the
      name of the catalog resource to be used for this Client.
      This record is required.
      </dd>
  <dt>Password = &lt;password&gt;</dt><dd>This is the password to be
      used when establishing a connection with the File services, so
      the Client configuration file on the machine to be backed up must
      have the same password defined for this Director.  This record is
      required.  
      If you have either <b>/dev/random</b>     
      <b>bc</b> on your machine, Bacula will generate a random 
      password during the configuration process, otherwise it will
      be left blank. </dd>

      <a name="FileRetention"></a>
  <dt>File Retention = &lt;time-period-specification&gt;</dt>
      <dd>The File Retention record defines the length of time that
      Bacula will keep File records in the Catalog database.
      When this time period expires, and if <b>AutoPrune</b> is set to
      <b>yes</b> Bacula will prune (remove) File records that
      are older than the specified File Retention period.  Note, this
      affects only records in the catalog database. It does not
      effect your archive backups. 
      <p> File records
      may actually be retained for a shorter period than you specify on
      this record if you specify either a shorter <b>Job Retention</b>
      or shorter <b>Volume Retention</b> period.  The shortest
      retention period of the three takes precedence.  
      The time may be expressed in seconds, minutes, 
      hours, days, weeks, months, quarters, or years.  See the <a
      href="configure.html#Time"> Configuration chapter</a> of this
      manual for additional details of time specification.  <p>The
      default is 60 days.  </dd>

      <a name="JobRetention"></a>
  <dt>Job Retention = &lt;time-period-specification&gt;</dt>
      <dd>The Job Retention record defines the length of time that
      Bacula will keep Job records in the Catalog database.
      When this time period expires, and if <b>AutoPrune</b> is set to
      <b>yes</b> Bacula will prune (remove) Job records that are
      older than the specified File Retention period.  As with the other
      retention periods, this affects only records in the catalog and
      not data in your archive backup.
      <p> If a Job
      record is selected for pruning, all associated File and JobMedia
      records will also be pruned regardless of the File Retention
      period set.  As a consequence, you normally will set the File
      retention period to be less than the Job retention period.  The
      Job retention period can actually be less than the value you
      specify here if you set the <b>Volume Retention</b> record in the
      Pool resource to a smaller duration.  This is because the Job
      retention period and the Volume retention period are
      independently applied, so the smaller of the two takes
      precedence.

      <p>The Job retention period is specified as seconds, 
      minutes, hours, days, weeks, months,  
      quarters, or years.
      See the <a href="configure.html#Time">
      Configuration chapter</a> of this manual for additional details of
      time specification.
      <p>The default is 180 days.
      </dd>
      <a name="AutoPrune"></a>

  <dt>AutoPrune = &lt;yes/no&gt;</dt><dd>
      If AutoPrune is set to
      <b>yes</b> (default), Bacula (version 1.20 or greater) will
      automatically apply the File retention period and the Job
      retention period for the Client at the end of the Job.
      If you set <b>AutoPrune = no</b>, pruning will not be done,
      and your Catalog will grow in size each time you run a Job.
      Pruning affects only information in the catalog and not data
      stored in the backup archives (on Volumes).
      </dd>

  <dt>Maximum Concurrent Jobs = &lt;number&gt;</dt><dd>where &lt;number&gt;
      is the maximum number of Jobs with the current Client that
      can run concurrently. Note, this record limits only Jobs
      for Clients
      with the same name as the resource in which it appears. Any
      other restrictions on the maximum concurrent jobs such as in
      the Director, Job, or Storage resources will also apply in addition to
      any limit specified here. The
      default is set to 1, but you may set it to a larger number. 
      We strongly recommend that you read the WARNING documented under
      <a href="dirdconf.html#DirMaxConJobs">
      Maximum Concurrent Jobs</a> in the Director's resource.
      </dd>

  <dt>*Priority = &lt;number&gt;</dt><dd>The number specifies the
      priority of this client relative to other clients that the
      Director is processing simultaneously.  The priority can range
      from 1 to 1000.  The clients are ordered such that the smaller
      number priorities are performed first (not currently
      implemented).</dd>
</dl>
The following is an example of a valid Client resource definition:
<pre>
Client {
  Name = Minimatou
  Address = minimatou
  Catalog = MySQL
  Password = very_good
}
</pre>


<h1><a name="StorageResource">The Storage Resource</a></h1>
The Storage resource defines which Storage daemons are available for use
by the Director.
<dl>
<dt>Storage</dt><dd>Start of the Storage records. At least one
  storage resource must be specified.</dd>

<dt>Name = &lt;name&gt;</dt><dd>The name of the storage resource.  This
  name appears on the Storage record specified in the Job record and
  is required. </dd>

<dt>Address = &lt;address&gt;</dt><dd>Where the address is a host name,
  a <b>fully qualified domain name</b>, or an <b>IP address</b>. Please note
  that the &lt;address&gt; as specified here will be transmitted to
  the File daemon who will then use it to contact the Storage daemon. Hence,
  it is <b>not</b>, a good idea to use <b>localhost</b> as the
  name but rather a fully qualified machine name or an IP address.
  This record is required. </dd>

<dt>SD Port = &lt;port&gt;</dt><dd>Where port is the port to use to
   contact the storage daemon for information and to start jobs.
   This same port number must appear in the Storage resource of the
   Storage daemon's configuration file. The default is 9103. </dd>

<dt>Password = &lt;password&gt;</dt><dd>This is the password to be used
  when establishing a connection with the Storage services. This
  same password also must appear in the Director resource of the Storage
  daemon's configuration file. This record is required.
  If you have either <b>/dev/random</b>     
  <b>bc</b> on your machine, Bacula will generate a random 
  password during the configuration process, otherwise it will
  be left blank. </dd>

<dt>Device = &lt;device-name&gt;</dt><dd>This record specifies the name
  of the device to be used to for the storage.  This name is not the
  physical device name, but the logical device name as defined on the
  <b>Name</b> record contained in the <b>Device</b> resource
  definition of the <b>Storage daemon</b> configuration file.  
  You can specify any name you would like (even the device name if
  you prefer) up to a maximum of 127 characters in length.
  The physical device name associated with this device is specified in
  the <b>Storage daemon</b> configuration file (as <b>Archive
  Device</b>). Please take care not to define two different
  Storage resource records in the Director that point to the
  same Device in the Storage daemon. Doing so may cause the
  Storage daemon to block (or hang) attempting to open the
  same device that is already open. This record is required.</dd>

<dt>Media Type = &lt;MediaType&gt;</dt><dd>This record specifies the
  Media Type to be used to store the data.  This is an arbitrary
  string of characters up to 127 maximum that you define. It can
  be anything you want. However, it is best to
  make it descriptive of the storage media (e.g.  File, DAT, &quot;HP
  DLT8000&quot;, 8mm, ...).  In addition, it is essential that you
  make the <b>Media Type</b> specification unique for each storage 
  media type. If you have two DDS-4 drives that have incompatible
  formats, or if you have a DDS-4 drive and a DDS-4 autochanger,
  you almost certainly should specify different <b>Media Types</b>.
  For the moment, this distinction is not very critical, but in a 
  later version of Bacula, it will be able to mount any Volume
  with <b>Media Type</b> <b>DDS-4</b> on any drive that supports
  <b>DDS-4</b>.
  <p>
  The <b>MediaType</b> specified here, <b>must</b>
  correspond to the <b>Media Type</b> specified in the <b> Device</b>
  resource of the <b>Storage daemon</b> configuration file.
  This record is required, and it is used by the Director and the
  Storage daemon to ensure that a Volume automatically selected from
  the Pool corresponds to the physical device. If a Storage daemon
  handles multiple devices (e.g. will write to various file Volumes
  on different partitions), this record allows you to specify exactly
  which device.
  <p>
  As mentioned above, the value specified in the Director's Storage
  resource must agree with the value specified in the Device resource in
  the <b>Storage daemon's</b> configuration file. It is also an
  additional check so
  that you don't try to write data for a DLT onto an 8mm device.</dd>

<a name="Autochanger"></a>
<dt>Autochanger = &lt;yes/no&gt;</dt>
   <dd>If you specify <b>yes</b>
   for this command (the default is <b>no</b>), when you use the <b>label</b>
   command or the <b>add</b> command to create a new Volume, <b>Bacula</b>
   will also request the Autochanger Slot number. This simplifies 
   creating database entries for Volumes in an autochanger. If you forget
   to specify the Slot, the autochanger will not be used. However, you
   may modify the Slot associated with a Volume at any time
   by using the <b>update volume</b> command in the console program.
   When <b>autochanger</b> is enabled, the algorithm used by
   Bacula to search for available volumes will be modified to 
   consider only Volumes that are known to be in the autochanger's
   magazine. If no <b>in changer</b> volume is found, Bacula will
   attempt recycling, pruning, ..., and if still no volume is found,
   Bacula will search for any volume whether or not in the magazine.
   By privileging in changer volumes, this procedure minimizes 
   operator intervention.
   The default is <b>no</b>. 
   <p>
   For the autochanger to be
   used, you must also specify <b>Autochanger = yes</b> in the
   <a href="storedconf.html#Autochanger">Device Resource</a>
   in the Storage daemon's configuration file as well as other
   important Storage daemon configuration information.
   Please consult the <a href="autochangers.html">
   Using Autochangers</a> manual of this chapter for the details of
   using autochangers. </dd>

<dt>Maximum Concurrent Jobs = &lt;number&gt;</dt><dd>where &lt;number&gt;
    is the maximum number of Jobs with the current Storage resource that
    can run concurrently. Note, this record limits only Jobs
    for Jobs using this Storage daemon. Any
    other restrictions on the maximum concurrent jobs such as in
    the Director, Job, or Client resources will also apply in addition to
    any limit specified here. The
    default is set to 1, but you may set it to a larger number. 
    We strongly recommend that you read the WARNING documented under
    <a href="dirdconf.html#DirMaxConJobs">
    Maximum Concurrent Jobs</a> in the Director's resource.
    <p>
    While it is possible to set the Director's, Job's, or Client's 
    maximum concurrent jobs greater than one, you should take great
    care in setting the Storage daemon's greater than one. By keeping
    this record set to one, you will avoid having two jobs simultaneously
    write to the same Volume. Although this is supported, it is not
    currently recommended.

    </dd>

</dl>
The following is an example of a valid Storage resource definition:
<pre>
\# Definition of tape storage device
Storage {
  Name = DLTDrive
  Address = lpmatou
  Password = storage_password # password for Storage daemon
  Device = "HP DLT 80"    # same as Device in Storage daemon
  Media Type = DLT8000    # same as MediaType in Storage daemon
}

</pre>


<h1><a name="PoolResource"></a>The Pool Resource</h1>
The Pool resource defines the set of storage Volumes (tapes or files) to
be used by Bacula to write the data. 
By configuring different
Pools, you can determine which set of Volumes (media) receives the
backup data. This permits, for example, to store all full backup
data on one set of Volumes and all incremental backups on another
set of Volumes. Alternatively, you could assign a different set 
of Volumes to each machine that you backup. This is most easily done
by defining multiple Pools.
<p>Another important aspect of a Pool is that it contains the default
attributes (Maximum Jobs, Retention Period, Recycle flag, ...) that
will be given to a Volume when it is created. This avoids the need
for you to answer a large number of questions when labeling a
new Volume.  Each of these attributes
can later be changed on a Volume by Volume basis using the <b>update</b>
command in the console program. Note that you must explicitly
specify which Pool Bacula is to use with each Job. Bacula will
not automatically search for the correct Pool.

<p>Most often in Bacula installations all backups for all machines 
(Clients) go to a single set of Volumes.  In this case, you will
probably only use the <b>Default</b> Pool.  If your backup strategy
calls for you to mount a different tape each day, you will probably
want to define a separate Pool for each day. For more information
on this subject, please see the <a href="strategies.html">Backup
Strategies</a> chapter of this manual.

<p>To use a Pool, there are three distinct steps.
First the Pool must be defined in the Director's
configuration file. Then the Pool must be written
to the Catalog database. This is done
automatically by the Director each time that it
starts, or alternatively can be done
using the <b>create</b> command in the console program.
Finally, if you change the Pool definition in the Director's
configuration file and restart Bacula, the pool will be 
updated alternatively you can 
use the <b>update pool</b> console command to refresh
the database image. It is this database image rather than
the Director's resource image that is used for the
default Volume attributes. Note, for the pool to
be automatically created or updated, it must be
explicitly referenced by a Job resource.

<p>Next the physical media must be labeled.
The labeling can either be done with the <b>label</b>
command in the <b>console</b> program or using the
<b>btape</b> program. The preferred method is to
use the <b>label</b> command in the <b>console</b>
program. 

<p>Finally, you must add Volume names (and their attributes) to the
Pool.  For Volumes to be used by Bacula they must be of the same
<b>Media Type</b> as the archive device specified for the job (i.e.  if
you are going to back up to a DLT device, the Pool must have DLT volumes
defined since 8mm volumes cannot be mounted on a DLT drive).  The
<b>Media Type</b> has particular importance if you are
backing up to files. When running a Job, you must explicitly specify
which Pool to use. Bacula will then automatically select the
next Volume to use from the Pool, but it will ensure that the
<b>Media Type</b> of any Volume selected from the Pool is identical
to that required by the Storage resource you have specified for the
Job.

<p>If you use the <b>label</b> command in the console
program to label the Volumes, they will automatically be
added to the Pool, so this last step is not normally
required. 

<p>It is also possible to add Volumes to the database
without explicitly labeling the physical volume. This is
done with the <b>add</b> console command.

<p>As previously mentioned, each time Bacula starts, it scans all
the Pools associated with each Catalog, and if the database record does
not already exist, it will be created from the Pool Resource definition.
<b>Bacula</b> probably should do an <b>update pool</b> if you change the
Pool definition, but currently, you must do this manually using
the <b>update pool</b> command in the Console program.

<p>The Pool Resource defined in the Director's
configuration file (bacula-dir.conf) may contain the following records:
<dl>
  <dt>Pool</dt><dd>Start of the Pool records. There must
    be at least one Pool resource defined. </dd>

  <dt>Name = &lt;name&gt;</dt><dd>The name of the pool.
    For most applications, you will use the default pool
    name <b>Default</b>. This record is required.</dd>

  <dt>Number of Volumes = &lt;number&gt;</dt><dd>This record specifies
      the number of volumes (tapes or files) contained in the pool.
      Normally, it is defined and updated automatically by the 
      Bacula catalog handling routines. </dd>

   <a name="MaxVolumes"></a>
  <dt>Maximum Volumes = &lt;number&gt;</dt><dd>This record specifies the
      maximum number of volumes (tapes or files) contained in the pool. 
      This record is optional, if omitted or set to zero, any number
      of volumes will be permitted. In general, this record is useful
      for Autochangers where there is a fixed number of Volumes, or
      for File storage where you wish to ensure that the backups made to
      disk files do not become too numerous or consume too much space.</dd>

  <dt>Pool Type = &lt;type&gt;</dt><dd>This record defines the pool
    type, which corresponds to the type of Job being run. It is
    required and may be one of the following:

        <ul>
        <li><b>Backup</b></li>
        <li><b>*Archive</b></li>
        <li><b>*Cloned</b></li>
        <li><b>*Migration</b></li>
        <li><b>*Copy</b></li>
        <li><b>*Save</b></li>
        </ul> 

  <dt>Use Volume Once = &lt;yes/no&gt;</dt><dd>This record
      if set to <b>yes</b> specifies that each volume is to be
      used only once. This is most useful when the Media is a 
      file and you want a new file for each backup that is
      done. The default is <b>no</b> (i.e. use volume any
      number of times). This record will most likely be phased out
      (deprecated), so you are recommended to use <b>Maximum Volume Jobs = 1</b>
      instead. </dd>

  <dt>Maximum Volume Jobs = &lt;positive-integer&gt;</dt><dd>This record specifies
      the maximum number of Jobs that can be written to the Volume. If 
      you specify zero (the default), there is no limit.  Otherwise,
      when the number of Jobs backed up to the Volume equals <b>positive-integer</b>
      the Volume will be marked <b>Used</b>. When the Volume is marked     
      <b>Used</b> it can no longer be used for appending Jobs, much like
      the <b>Full</b> status but it can be recycled if recycling is enabled.     
      By setting <b>MaximumVolumeJobs</b> to one, you get the same 
      effect as setting <b>UseVolumeOnce = yes</b>.</dd>

  <dt>Maximum Volume Files = &lt;positive-integer&gt;</dt><dd>This record specifies
      the maximum number of files that can be written to the Volume. If 
      you specify zero (the default), there is no limit.  Otherwise,
      when the number of files written to the Volume equals <b>positive-integer</b>
      the Volume will be marked <b>Used</b>. When the Volume is marked     
      <b>Used</b> it can no longer be used for appending Jobs, much like
      the <b>Full</b> status but it can be recycled if recycling is enabled.     
      This value is checked and the <b>Used</b> status is set only
      at the end of a job that writes to the particular volume.      
      </dd>

  <dt>Maximum Volume Bytes = &lt;size&gt;</dt><dd>This record specifies
      the maximum number of bytes that can be written to the Volume. If 
      you specify zero (the default), there is no limit except the
      physical size of the Volume.  Otherwise,
      when the number of bytes written to the Volume equals <b>size</b>
      the Volume will be marked <b>Used</b>. When the Volume is marked     
      <b>Used</b> it can no longer be used for appending Jobs, much like
      the <b>Full</b> status but it can be recycled if recycling is enabled.     
      This value is checked and the <b>Used</b> status set while 
      the job is writing to the particular volume.      
      </dd>

  <dt>Volume Use Duration = &lt;time-period-specification&gt;</dt><dd>
      The Volume Use Duration record defines the time period that   
      the Volume can be written beginning from the time of first data
      write to the Volume. If the time-period specified is zero (the
      default), the Volume can be written indefinitely. Otherwise,
      when the time period from the first write to the volume (the
      first Job written) exceeds the time-period-specification, the
      Volume will be marked <b>Used</b>, which means that no more
      Jobs can be appended to the Volume, but it may be recycled if
      recycling is enabled.                                      
      <p>You might use this record, for example, if you have a Volume
      used for Incremental backups, and Volumes used for Weekly Full
      backups. Once the Full backup is done, you will want to use a 
      different Incremental Volume. This can be accomplished by setting
      the Volume Use Duration for the Incremental Volume to six days.
      I.e. it will be used for the 6 days following a Full save, then
      a different Incremental volume will be used.
      <p>
      This value is checked and the <b>Used</b> status is set only
      at the end of a job that writes to the particular volume, which
      means that even though the use duration may have expired, the
      catalog entry will not be updated until the next job that
      uses this volume is run.   </dd>

  <dt>Catalog Files = &lt;yes/no&gt;</dt><dd>This record
      defines whether or not you want the names of the files   
      that were saved to be put into the catalog. The default
      is <b>yes</b>. The advantage of specifying <b>Catalog Files = No</b>
      is that you will have a significantly smaller Catalog database. The
      disadvantage is that you will not be able to produce a Catalog listing
      of the files backed up for each Job (this is often called Browsing).     
      Also, without the File entries in the catalog, you will not be
      able to use the Console <b>restore</b> command nor any other
      command that references File entries.</dd>

    <a name="PoolAutoPrune"></a>
   <dt>AutoPrune = &lt;yes/no&gt;</dt><dd>If AutoPrune is set to
       <b>yes</b> (default), Bacula (version 1.20 or greater) will
       automatically apply the Volume Retention period when new Volume
       is needed and no appendable Volumes exist in the Pool.  Volume
       pruning causes expired Jobs (older than the <b>Volume
       Retention</b> period) to be deleted from the Catalog and permits
       possible recycling of the Volume.</dd>

    <a name="VolRetention"></a>
   <dt>Volume Retention = &lt;time-period-specification&gt;</dt><dd>The
       Volume Retention record defines the length of time that <b>Bacula</b>
       will keep Job records associated with the Volume in the Catalog
       database.  When this time period expires, and if <b>AutoPrune</b>
       is set to <b>yes</b> Bacula will prune (remove) Job
       records that are older than the specified Volume Retention period.
       All File records associated with pruned Jobs are also pruned.
       The time may be specified as seconds,
       minutes, hours, days, weeks, months, quarters, or years.
       The <b>Volume Retention</b> applied independently to the  
       <b>Job Retention</b> and the <b>File Retention</b> periods 
       defined in the Client resource. This means that the shorter
       period is the one that applies. Note, that when the           
       <b>Volume Retention</b> period has been reached, it will
       prune both the Job and the File records.
       <p>The default is 365 days. Note, this record sets the default
       value for each Volume entry in the Catalog when the Volume is
       created. The value in the
       catalog may be later individually changed for each Volume using
       the Console program. 
       <p>
       By defining multiple Pools with different Volume Retention periods,
       you may effectively have a set of tapes that is recycled weekly,
       another Pool of tapes that is recycled monthly and so on. However,
       one must keep in mind that if your <b>Volume Retention</b> period
       is too short, it may prune the last valid Full backup, and hence
       until the next Full backup is done, you will not have a complete
       backup of your system, and in addition, the next Incremental
       or Differential backup will be promoted to a Full backup. As 
       a consequence, the minimum <b>Volume Retention</b> period should be at
       twice the interval of your Full backups. This means that if you   
       do a Full backup once a month, the minimum Volume retention
       period should be two months.    </dd>

  <a name="PoolRecycle"></a>
  <dt>Recycle = &lt;yes/no&gt;</dt><dd>This record specifies the 
      default for recycling Purged Volumes. If it is set to <b>yes</b>
      and Bacula needs a volume but finds none that are
      appendable, it will search for Purged Volumes (i.e. volumes
      with all the Jobs and Files expired and thus deleted from
      the Catalog). If the Volume is recycled, all previous data
      written to that Volume will be overwritten.</dd>

  <a name="RecycleOldest"></a>
  <dt>Recycle Oldest Volume = &lt;yes/no&gt;</dt><dd>This record
      instructs the Director to search for the oldest used  
      Volume in the Pool when another Volume is requested by
      the Storage daemon and none are available.
      The catalog is then <b>pruned</b> respecting the retention
      periods of all Files and Jobs written to this Volume.
      If all Jobs are pruned (i.e. the volume is Purged), then
      the Volume is recycled and will be used as the next
      Volume to be written. This record respects any Job,
      File, or Volume retention periods that you may have specified,
      and as such it is <b>much</b> better to use this record
      than the Purge Oldest Volume.

      <p>
      This record can be useful if you have
      a fixed number of Volumes in the Pool and you want to
      cycle through them and you have specified the correct 
      retention periods.</dd>

  <a name="RecycleCurrent"></a>
  <dt>Recycle Current Volume = &lt;yes/no&gt;</dt><dd>If
      Bacula needs a new Volume, this record instructs Bacula
      to Prune the volume respecting the Job and File
      retention periods. 
      If all Jobs are pruned (i.e. the volume is Purged), then
      the Volume is recycled and will be used as the next
      Volume to be written. This record respects any Job,
      File, or Volume retention periods that you may have specified,
      and thus it is <b>much</b> better to use it rather             
      than the Purge Oldest Volume record.

      <p>
      This record can be useful if you have:
      a fixed number of Volumes in the Pool, you want to
      cycle through them, and you have specified
      retention periods that prune Volumes before
      you have cycled through the Volume in the Pool.</dd>

  <a name="PurgeOldest"></a>
  <dt>Purge Oldest Volume = &lt;yes/no&gt;</dt><dd>This record
      instructs the Director to search for the oldest used  
      Volume in the Pool when another Volume is requested by
      the Storage daemon and none are available.
      The catalog is then <b>purged</b> irrespective of retention
      periods of all Files and Jobs written to this Volume.
      The Volume is then recycled and will be used as the next
      Volume to be written. This record overrides any Job,
      File, or Volume retention periods that you may have specified.
      <p>
      This record can be useful if you have
      a fixed number of Volumes in the Pool and you want to
      cycle through them and when all Volumes are full, but you don't
      want to worry about setting proper retention periods.  However,
      by using this option you risk losing valuable data.

      <p><b>Please be aware that <b>Purge Oldest Volume</b> disregards
      all retention periods.</b> If you have only a single Volume 
      defined and you turn this variable on, that Volume will always
      be immediately overwritten when it fills! So at a minimum,
      ensure that you have a decent number of Volumes in your Pool
      before running any jobs. If you want retention periods to apply
      do not use this record. To specify a retention period,
      use the <b>Volume Retention</b> record (see above).
      <p>
      I highly recommend against using this record, because it is
      sure that some day, Bacula will recycle a Volume that contains
      current data.  </dd>


  <dt>Accept Any Volume = &lt;yes/no&gt;</dt><dd>This record
      specifies whether or not any volume from the Pool may
      be used for backup.  The default is <b>yes</b> as of version
      1.27 and later. If it is <b>no</b> then only the first
      writable volume in the Pool will be accepted for writing backup
      data, thus Bacula will fill each Volume sequentially
      in turn before using any other appendable volume in the
      Pool. If this is <b>no</b> and you mount a volume out
      of order, Bacula will not accept it.  If this
      is <b>yes</b> any appendable volume from the pool
      mounted will be accepted.  
      <p>If your tape backup procedure dictates that you manually
      mount the next volume, you will almost certainly want to be
      sure this record is turned on.
      <p>
      If you are going on vacation and you think the current volume
      may not have enough room on it, you can simply label a new tape
      and leave it in the drive, and assuming that <b>Accept Any Volume</b>
      is <b>yes</b> Bacula will begin writing on it. When you return
      from vacation, simply remount the last tape, and Bacula will
      continue writing on it until it is full.  Then you can remount
      your vacation tape and Bacula will fill it in turn.
      </dd>

  <dt>Cleaning Prefix = &lt;string&gt;</dt><dd>This record defines
      a prefix string, which if it matches the beginning of 
      a Volume  name during labeling of a Volume, the Volume
      will be defined with the VolStatus set to <b>Cleaning</b> and
      thus Bacula will never attempt to use this tape. This
      is primarily for use with autochangers that accept barcodes
      where the convention is that barcodes beginning with <b>CLN</b>
      are treated as cleaning tapes.</dd>

  <a name="Label"></a>
  <dt>Label Format = &lt;format&gt;</dt><dd>This record specifies the
    format of the labels contained in this pool. The format record
    is used as a sort of template to create new Volume names during
    automatic Volume labeling. 
    <p>The <b>format</b> should be specified in double quotes, and
    consists of letters, numbers and the special characters
    hyphen (<b>-</b>), underscore (<b>_</b>), colon (<b>:</b>), and 
    period (<b>.</b>), which are the legal characters for a Volume
    name. The <b>format</b> should be enclosed in
    double quotes (&quot;).
    <p>In addition, the format may contain a number of variable expansion
    characters which will be expanded by a complex algorithm allowing
    you to create Volume names of many different formats. In all
    cases, the expansion process must resolve to the set of characters
    noted above that are legal Volume names. Generally, these
    variable expansion characters begin with a dollar sign (<b>$</b>)
    or a left bracket (<b>[</b>). If you specify variable expansion
    characters, you should always enclose the format with double 
    quote characters (<b>&quot;</b>). For more details on variable expansion,
    please see the <a href="vars.html">Variable Expansion</a> Chapter of
    this manual.
    <p>If no variable expansion characters are found in the string,
    the Volume name will be formed from the <b>format</b> string
    appended with the number of volumes in the pool plus one, which
    will be edited as four digits with leading zeros.  For example,
    with a <b>Label Format = &quot;File-&quot;</b>, the first volumes will be
    named <b>File-0001</b>, <b>File-0002</b>, ...
    <p>With the exception of Job specific variables, you can test
    your <b>LabelFormat</b> by using the <a href="console.html#var">
    <b>var</b> command</a> the Console Chapter of this manual.
    <p>
    In almost all cases, you should enclose the format specification
    (part after the equal sign) in double quotes.
    <dd>
</dl>
In order for a Pool to be used during a Backup Job, the Pool must have
at least one Volume associated with it.  Volumes are created
for a Pool using the <b>label</b> or the <b>add</b> commands in the
<b>Bacula Console</b>,
program.  In addition to adding Volumes to the Pool (i.e.  putting the
Volume names in the Catalog database), the physical Volume must be
labeled with valid Bacula software volume label before
<b>Bacula</b> will accept the Volume.  This will be automatically done
if you use the <b>label</b> command.  Bacula can
automatically label Volumes if instructed to do so, but this feature is
not yet fully implemented.

<p>
<p> The following is an
example of a valid Pool resource definition: 
<pre> 
Pool {
  Name = Default
  Pool Type = Backup
}
</pre>


<h1><a name="CatalogResource"></a>The Catalog Resource</h1>
The Catalog Resource defines what catalog to use for the
current job. Currently, Bacula can only handle
a single database server (SQLite, MySQL, built-in) that is 
defined when configuring <b>Bacula</b>. However, there
may be as many Catalogs (databases) defined as you
wish. For example, you may want each Client to have
its own Catalog database, or you may want backup
jobs to use one database and verify or restore
jobs to use another database.

<dl>
  <dt>Catalog</dt><dd>Start of the Catalog records.
     At least one Catalog resource must be defined. </dd>

  <dt>Name = &lt;name&gt;</dt><dd>The name of the Catalog. No 
     necessary relation to the database server name. This name
     will be specified in the Client resource record indicating
     that all catalog data for that Client is maintained in this
     Catalog. This record is required.</dd>

  <dt>password = &lt;password&gt;</dt><dd>This specifies the password
      to use when logging into the database. This record is required.</dd>

  <dt>DB Name = &lt;name&gt;</dt><dd>This specifies the name of the
     database. If you use multiple catalogs (databases), you specify
     which one here. If you are using an external database server
     rather than the internal one, you must specify a name that
     is known to the server (i.e. you explicitly created the
     Bacula tables using this name. This record is
     required. </dd>

  <dt>user = &lt;user&gt;</dt><dd>This specifies what user name
      to use to log into the database. This record is required.</dd>

  <dt>DB Socket = &lt;socket-name&gt;</dt><dd>This is the name of
      a socket to use on the local host to connect to the database.
      This record is used only by MySQL and is ignored by
      SQLite. Normally, if neither <b>DB Socket</b> or <b>DB Address</b>
      are specified, MySQL will use the default socket.</dd>

  <dt>DB Address = &lt;address&gt;</dt><dd>This is the host address
      of the database server. Normally, you would specify this instead
      of <b>DB Socket</b> if the database server is on another machine.
      In that case, you will also specify <b>DB Port</b>. This record
      is used only by MySQL and is ignored by SQLite if provided.
      This record is optional.</dd>

  <dt>DB Port = &lt;port&gt;</dt><dd>This defines the port to
      be used in conjunction with <b>DB Address</b> to access the
      database if it is on another machine. This record is used
      only by MySQL and is ignored by SQLite if provided. This
      record is optional.</dd>
         
</dl>
The following is an example of a valid Catalog resource definition:
<pre>
Catalog 
{  
  Name = SQLite
  dbname = bacula; 
  user = bacula; 
  password = ""                       # no password = no security
}
</pre>

or for a Catalog on another machine:
<pre>
Catalog
{
  Name = MySQL
  dbname = bacula
  user = bacula
  password = ""
  DB Address = remote.acme.com
  DB Port = 1234
}
</pre>


<h1><a name="MessagesResource"></a>The Messages Resource</h1>
For the details of the Messages Resource, please see the
<a href="messagesres.html">Messages Resource Chapter</a> of
this manual. 


<h1><a name="ConsoleResource"></a>The Console Resource</h1>
As of Bacula version 1.33 and higher, there are three different
kinds of consoles, which the administrator or user can use to
interact with the Director. These three kinds of consoles comprise
three different security levels. 
<ul>
  <li>The first console type is an <b>anonymous</b> or <b>default</b>
      console, which
      has full privileges.  There is no console resource necessary
      for this type since the password is specified in the Director's
      resource and consequently such consoles do not have an
      name as defined on a <b>Name =</b> directive.  This is the kind of
      console that was initially implemented in versions prior to 1.33
      and remains valid.  Typically you would use it only for
      administrators.</li>
  <li>The second type of console, and new to version 1.33 and
      higher is a &quot;named&quot; console defined within
      a Console resource in both the Director's configuration file and in
      the Console's configuration file. Both the names and the passwords
      in these two entries must match much as is the case for
      Client programs.
      <p>This second type of console begins with absolutely no
      privileges except those explicitly specified in the Director's
      Console resource. Thus you can have multiple Consoles with
      different names and passwords, sort of like multiple users, each
      with different privileges.  As a
      default, these consoles can do absolutely nothing -- no commands
      what so ever.  You give them privileges or rather access
      to commands and resources by specifying access
      control lists in the Director's Console resource.  The ACLs are
      specified by a directive followed by a list of access names.
      Examples of this are shown below.</li>
  <li>The third type of console is similar to the above mentioned
      one in that it requires a Console resource definition in both
      the Director and the Console. In addition, if the console name,
      provided on the <b>Name =</b> directive, is the same as a Client
      name, that console is permitted to use the <b>SetIP</b>
      command to change the Address directive in the
      Director's client resource to the IP address of the Console.  This
      permits portables or other machines using DHCP (non-fixed IP addresses) 
      to &quot;notify&quot; the Director of their current IP address.
      </li>
</ul>
<p>
The Console resource is optional and need not be specified.
The following directives are permited within the Director's configuration
resource:
<dl>
  <dt>Name = &lt;name&gt;</dt><dd>The name of the console. This
  name must match the name specified in the Console's configuration
  resource (much as is the case with Client definitions).</dd>
  <dt>Password = &lt;password&gt;</dt><dd>Specifies the password that
    must be supplied for a named Bacula Console to be authorized.  The same
    password must appear in the <b>Console</b> resource of the Console
    configuration file.  For added security, the password is never
    actually passed across the network but rather a challenge response
    hash code created with the password.  This record is required.
    If you have either <b>/dev/random</b>     
    <b>bc</b> on your machine, Bacula will generate a random 
    password during the configuration process, otherwise it will
    be left blank. </dd>
  <dt>JobACL = &lt;name-list&gt;</dt><dd>This directive is used to
    specify a list of Job resource names that can be accessed by
    the console. Without this directive, the console cannot access
    any of the Director's Job resources. Multiple Job resource names
    may be specified by separating them with commas, and/or by specifying
    multiple JobACL directives. For example, the directive
    may be specified as:
    <pre>
    JobACL = kernsave, "Backup client 1", "Backup client 2"
    JobACL = "RestoreFiles"
    </pre>
    With the above specification, the console can access the Director's
    resource records for the four jobs named on the JobACL directives.
    </dd>
  <dt>ClientACL = &lt;name-list&gt;</dt><dd>This directive is used to
    specify a list of Client resource names that can be accessed by
    the console.</dd>
  <dt>StorageACL = &lt;name-list&gt;</dt><dd>This directive is used to
    specify a list of Storage resource names that can be accessed by
    the console.</dd>
  <dt>ScheduleACL = &lt;name-list&gt;</dt><dd>This directive is used to
    specify a list of Schedule resource names that can be accessed by
    the console.</dd>
  <dt>PoolACL = &lt;name-list&gt;</dt><dd>This directive is used to
    specify a list of Pool resource names that can be accessed by
    the console.</dd>
  <dt>FileSetACL = &lt;name-list&gt;</dt><dd>This directive is used to
    specify a list of FileSet resource names that can be accessed by
    the console.</dd>
  <dt>CatalogACL = &lt;name-list&gt;</dt><dd>This directive is used to
    specify a list of Catalog resource names that can be accessed by
    the console.</dd>
  <dt>CommandACL = &lt;name-list&gt;</dt><dd>This directive is used to
    specify a list of of console commands that can be executed by
    the console. </dd>
</dl>
Aside from Director resource names and console command names, the
special keyword <b>*all*</b> can be specified in any of the above
access control lists. When this keyword is present, any resource or
command name (which ever is appropriate) will be accepted.



<h1><a name="CounterResource"></a>The Counter Resource</h1>
The Counter Resource defines a counter variable that can
be accessed by variable expansion used for creating
Volume labels with the <b>LabelFormat</b> record.
See the <a href="dirdconf.html#Label">LabelFormat</a>
record in this chapter for more details.

<dl>
  <dt>Counter</dt><dd>Start of the Counter record.
     Counter records are optional. </dd>

  <dt>Name = &lt;name&gt;</dt><dd>The name of the Counter.
     This is the name you will use in the variable expansion
     to reference the counter value.</dd>

  <dt>Minimum = &lt;integer&gt;</dt><dd>This specifies the minimum
      value that the counter can have. It also becomes the default.
      If not supplied, zero is assumed.</dd>

  <dt>Maximum = &lt;integer&gt;<dt><dd>This is the maximum value
      value that the counter can have. If not specified or set to
      zero, the counter can have a maximum value of 2,147,483,648
      (2 to the 31 power). When the counter is incremented past
      this value, it is reset to the Minimum.</dd>

  <dt>*WrapCounter = &lt;counter-name&gt;</dt><dd>If this value
     is specified, when the counter is incremented past the maximum
     and thus reset to the minimum, the counter specified on the 
     <b>WrapCounter</b> is incremented. (This is not currently
     implemented). </dd>

  <dt>Catalog = &lt;catalog-name&gt;</dt><dd>If this record is
      specified, the counter and its values will be saved in
      the specified catalog. If this record is not present, the
      counter will be redefined each time that Bacula is started.</dd>
</dl>


<h1><a name="SampleDirectorConfiguration">
A Complete Example Director Configuration File</a></h1>
An example Director configuration file might be the following:
<pre>
\#
\# Default Bacula Director Configuration file
\#
\#  The only thing that MUST be changed is to add one or more
\#   file or directory names in the Include directive of the
\#   FileSet resource.
\#
\#  For Bacula release 1.15 (5 March 2002) -- redhat
\#
\#  You might also want to change the default email address
\#   from root to your address.  See the "mail" and "operator"
\#   directives in the Messages resource.
\#

Director {                            \# define myself
  Name = rufus-dir
  QueryFile = "/home/kern/bacula/bin/query.sql"
  WorkingDirectory = "/home/kern/bacula/bin/working"
  PidDirectory = "/home/kern/bacula/bin/working"
  Password = "XkSfzu/Cf/wX4L8Zh4G4/yhCbpLcz3YVdmVoQvU3EyF/" 
}

\# Define the backup Job
Job {
  Name = "NightlySave"
  Type = Backup
  Level = Incremental                 # default
  Client=rufus-fd 
  FileSet="Full Set"
  Schedule = "WeeklyCycle"
  Storage = DLTDrive
  Messages = Standard
  Pool = Default
}

Job {
  Name = "Restore"
  Type = Restore
  Client=rufus-fd 
  FileSet="Full Set"
  Where = /tmp/bacula-restores
  Storage = DLTDrive
  Messages = Standard
  Pool = Default
}
   

\# List of files to be backed up
FileSet {
  Name = "Full Set"
  Include = signature=SHA1 { 
\#    
\#  Put your list of files here, one per line or include an
\#    external list with:
\#
\#    @file-name
\#
\#  Note: / backs up everything

  /

  }
  Exclude = { }
}

\# When to do the backups
Schedule {
  Name = "WeeklyCycle"
  Run = Full sun at 1:05
  Run = Incremental mon-sat at 1:05
}

\# Client (File Services) to backup
Client {
  Name = rufus-fd
  Address = rufus
  Catalog = MyCatalog
  Password = "MQk6lVinz4GG2hdIZk1dsKE/LxMZGo6znMHiD7t7vzF+" 
  File Retention = 60d      # sixty day file retention
  Job Retention = 1y        # 1 year Job retention
  AutoPrune = yes           # Auto apply retention periods
}


\# Definition of DLT tape storage device
Storage {
  Name = DLTDrive
  Address = rufus
  Password = "jMeWZvfikUHvt3kzKVVPpQ0ccmV6emPnF2cPYFdhLApQ" 
  Device = "HP DLT 80"      # same as Device in Storage daemon
  Media Type = DLT8000      # same as MediaType in Storage daemon
}

\# Definition of DDS tape storage device
Storage {
  Name = SDT-10000
  Address = rufus
  Password = "jMeWZvfikUHvt3kzKVVPpQ0ccmV6emPnF2cPYFdhLApQ" 
  Device = SDT-10000        # same as Device in Storage daemon
  Media Type = DDS-4        # same as MediaType in Storage daemon
}

\# Definition of 8mm tape storage device
Storage {
  Name = "8mmDrive"
  Address = rufus
  Password = "jMeWZvfikUHvt3kzKVVPpQ0ccmV6emPnF2cPYFdhLApQ"
  Device = "Exabyte 8mm"
  MediaType = "8mm"
}

\# Definition of file storage device
Storage {
  Name = File
  Address = rufus
  Password = "jMeWZvfikUHvt3kzKVVPpQ0ccmV6emPnF2cPYFdhLApQ"
  Device = FileStorage
  Media Type = File
}


\# Generic catalog service
Catalog {
  Name = MyCatalog
  dbname = bacula; user = bacula; password = ""
}

\# Reasonable message delivery -- send most everything to 
\#   the email address and to the console
Messages {
  Name = Standard
  mail = root@localhost = all, !skipped, !terminate
  operator = root@localhost = mount
  console = all, !skipped, !saved
}
    
\# Default pool definition
Pool {
  Name = Default
  Pool Type = Backup
  AutoPrune = yes
  Recycle = yes
}

</pre>

<page_prev name="Bacula Configuration" url="configure.html">
<page_next name="Client/File daemon Configuration" url="filedconf.html">
