]> git.sur5r.net Git - bacula/docs/blob - docs/manuals/en/install/dirdconf.tex
Update
[bacula/docs] / docs / manuals / en / install / dirdconf.tex
1 %%
2 %%
3
4 \chapter{Configuring the Director}
5 \label{DirectorChapter}
6 \index[general]{Director!Configuring the}
7 \index[general]{Configuring the Director}
8
9 Of all the configuration files needed to run {\bf Bacula}, the Director's is
10 the most complicated, and the one that you will need to modify the most often
11 as you add clients or modify the FileSets. 
12
13 For a general discussion of configuration files and resources including the
14 data types recognized by {\bf Bacula}. Please see the 
15 \ilink{Configuration}{ConfigureChapter} chapter of this manual. 
16
17 \section{Director Resource Types}
18 \index[general]{Types!Director Resource}
19 \index[general]{Director Resource Types}
20
21 Director resource type may be one of the following: 
22
23 Job, JobDefs, Client, Storage, Catalog, Schedule, FileSet, Pool, Director,  or
24 Messages. We present them here in the most logical order for defining them: 
25
26 Note, everything revolves around a job and is tied to a job in one
27 way or another.
28
29 \begin{itemize}
30 \item 
31    \ilink{Director}{DirectorResource4} -- to  define the Director's
32    name and its access password used for authenticating the Console program.
33    Only a single  Director resource definition may appear in the Director's 
34    configuration file.  If you have either {\bf /dev/random} or  {\bf bc} on your
35    machine, Bacula will generate a random password during the configuration
36    process, otherwise it will  be left blank. 
37 \item 
38    \ilink{Job}{JobResource} -- to define the backup/restore Jobs 
39    and to tie together the Client, FileSet and Schedule resources to  be used
40    for each Job. Normally, you will Jobs of different names corresponding
41    to each client (i.e. one Job per client, but a different one with a different name
42    for each client).
43 \item 
44    \ilink{JobDefs}{JobDefsResource} -- optional resource for 
45    providing defaults for Job resources.  
46 \item 
47    \ilink{Schedule}{ScheduleResource} -- to define when a Job is to 
48    be automatically run by {\bf Bacula's} internal scheduler. You 
49    may have any number of Schedules, but each job will reference only
50    one.
51 \item 
52    \ilink{FileSet}{FileSetResource} -- to define the set of files 
53    to be backed up for each Client. You may have any number of
54    FileSets but each Job will reference only one.
55 \item 
56    \ilink{Client}{ClientResource2} -- to define what Client is to be
57    backed up. You will generally have multiple Client definitions. Each 
58    Job will reference only a single client.
59 \item 
60    \ilink{Storage}{StorageResource2} -- to define on what physical
61    device the Volumes should be mounted. You may have one or
62    more Storage definitions.
63 \item 
64    \ilink{Pool}{PoolResource} -- to define the pool of Volumes
65    that can be used for a particular Job. Most people use a
66    single default Pool.  However, if you have a large number
67    of clients or volumes, you may want to have multiple Pools.
68    Pools allow you to restrict a Job (or a Client) to use
69    only a particular set of Volumes.
70 \item 
71    \ilink{Catalog}{CatalogResource} -- to define in what database to
72    keep the list of files and the Volume names where they are backed up.  
73    Most people only use a single catalog.  However, if you want to
74    scale the Director to many clients, multiple catalogs can be helpful.
75    Multiple catalogs require a bit more management because in general
76    you must know what catalog contains what data.  Currently, all 
77    Pools are defined in each catalog.  This restriction will be removed
78    in a later release.
79 \item 
80    \ilink{Messages}{MessagesChapter} -- to define where error and
81    information messages are to be sent or logged. You may define
82    multiple different message resources and hence direct particular
83    classes of messages to different users or locations (files, ...).
84 \end{itemize}
85
86 \section{The Director Resource}
87 \label{DirectorResource4}
88 \index[general]{Director Resource}
89 \index[general]{Resource!Director}
90
91 The Director resource defines the attributes of the Directors running on the
92 network. In the current implementation, there is only a single Director
93 resource, but the final design will contain multiple Directors to maintain
94 index and media database redundancy. 
95
96 \begin{description}
97
98 \item [Director]
99    \index[dir]{Director}
100    Start of the Director resource. One and only one  director resource must be
101 supplied.  
102
103 \item [Name = \lt{}name\gt{}]
104    \index[dir]{Name}
105    \index[dir]{Directive!Name}
106    The director name used by the system  administrator. This directive is
107 required.  
108
109 \item [Description = \lt{}text\gt{}]
110    \index[dir]{Description}
111    \index[dir]{Directive!Description}
112    The text field contains a  description of the Director that will be displayed
113 in the  graphical user interface. This directive is optional.  
114
115 \item [Password = \lt{}UA-password\gt{}]
116    \index[dir]{Password}
117    \index[dir]{Directive!Password}
118    Specifies the password that must be supplied for the default Bacula
119    Console to be authorized.  The same password must appear in the {\bf
120    Director} resource of the Console configuration file.  For added
121    security, the password is never passed across the network but instead a
122    challenge response hash code created with the password.  This directive
123    is required.  If you have either {\bf /dev/random} or {\bf bc} on your
124    machine, Bacula will generate a random password during the configuration
125    process, otherwise it will be left blank and you must manually supply
126    it.
127
128    The password is plain text.  It is not generated through any special
129    process but as noted above, it is better to use random text for 
130    security reasons.
131
132 \item [Messages = \lt{}Messages-resource-name\gt{}]
133    \index[dir]{Messages}
134    \index[dir]{Directive!Messages}
135    The messages resource  specifies where to deliver Director messages that are
136    not associated  with a specific Job. Most messages are specific to a job and
137    will  be directed to the Messages resource specified by the job. However, 
138    there are a few messages that can occur when no job is running.  This
139    directive is required.  
140
141 \item [Working Directory = \lt{}Directory\gt{}]
142    \index[dir]{Working Directory}
143    \index[dir]{Directive!Working Directory}
144    This directive  is mandatory and specifies a directory in which the Director 
145    may put its status files. This directory should be used only  by Bacula but
146    may be shared by other Bacula daemons. However, please note, if this
147    directory is shared with other Bacula daemons (the File daemon and Storage
148    daemon), you must ensure that the {\bf Name} given to each daemon is
149    unique so that the temporary filenames used do not collide.  By default
150    the Bacula configure process creates unique daemon names by postfixing them
151    with -dir, -fd, and -sd. Standard shell expansion of the {\bf
152    Directory}  is done when the configuration file is read so that values such 
153    as {\bf \$HOME} will be properly expanded. This directive is required.
154    The working directory specified must already exist and be
155    readable and writable by the Bacula daemon referencing it.
156
157    If you have specified a Director user and/or a Director group on your
158    ./configure line with {\bf {-}{-}with-dir-user} and/or 
159    {\bf {-}{-}with-dir-group} the Working Directory owner and group will
160    be set to those values.
161
162 \item [Pid Directory = \lt{}Directory\gt{}]
163    \index[dir]{Pid Directory}
164    \index[dir]{Directive!Pid Directory}
165    This directive  is mandatory and specifies a directory in which the Director 
166    may put its process Id file. The process Id file is used to  shutdown
167    Bacula and to prevent multiple copies of  Bacula from running simultaneously. 
168    Standard shell expansion of the {\bf Directory}  is done when the
169    configuration file is read so that values such  as {\bf \$HOME} will be
170    properly expanded.  
171
172    The PID directory specified must already exist and be
173    readable and writable by the Bacula daemon referencing it
174
175    Typically on Linux systems, you will set this to:  {\bf /var/run}. If you are
176    not installing Bacula in the  system directories, you can use the {\bf Working
177    Directory} as  defined above.  This directive is required.  
178
179 \item [Scripts Directory = \lt{}Directory\gt{}]
180    \index[dir]{Scripts Directory}
181    \index[dir]{Directive!Scripts Directory}
182    This directive is optional and, if defined, specifies a directory in
183    which the Director will look for the Python startup script {\bf
184    DirStartup.py}.  This directory may be shared by other Bacula daemons.
185    Standard shell expansion of the directory is done when the configuration
186    file is read so that values such as {\bf \$HOME} will be properly
187    expanded.
188
189 \item [QueryFile = \lt{}Path\gt{}]
190    \index[dir]{QueryFile}
191    \index[dir]{Directive!QueryFile}
192    This directive is mandatory and specifies a directory and file in which
193    the Director can find the canned SQL statements for the {\bf Query}
194    command of the Console.  Standard shell expansion of the {\bf Path} is
195    done when the configuration file is read so that values such as {\bf
196    \$HOME} will be properly expanded.  This directive is required.
197
198 \item [Heartbeat Interval = \lt{}time-interval\gt{}]
199    \index[dir]{Heartbeat Interval}
200    \index[dir]{Directive!Heartbeat}
201    This directive is optional and if specified will cause the Director to
202    set a keepalive interval (heartbeat) in seconds on each of the sockets
203    it opens for the Client resource.  This value will override any
204    specified at the Director level.  It is implemented only on systems
205    (Linux, ...) that provide the {\bf setsockopt} TCP\_KEEPIDLE function.
206    The default value is zero, which means no change is made to the socket.
207
208
209 \label{DirMaxConJobs}
210 \item [Maximum Concurrent Jobs = \lt{}number\gt{}]
211    \index[dir]{Maximum Concurrent Jobs}
212    \index[dir]{Directive!Maximum Concurrent Jobs}
213    \index[general]{Simultaneous Jobs}
214    \index[general]{Concurrent Jobs}
215    where \lt{}number\gt{}  is the maximum number of total Director Jobs that
216    should run  concurrently. The default is set to 1, but you may set it to a 
217    larger number.  
218
219    Please  note that the Volume format becomes much more complicated with 
220    multiple simultaneous jobs, consequently, restores can take much  longer if
221    Bacula must sort through interleaved volume blocks from  multiple simultaneous
222    jobs. This can be avoided by having each  simultaneously running job write to
223    a different volume or  by using data spooling, which will first spool the data
224    to disk simultaneously, then write each spool file to the  volume in
225    sequence.  
226
227    There may also still be some cases where directives such as  {\bf Maximum
228    Volume Jobs} are not properly synchronized with  multiple simultaneous jobs
229    (subtle timing issues can arise),  so careful testing is recommended. 
230
231    At the current time,  there is no configuration parameter set to limit the
232    number of console connections. A maximum of five simultaneous console 
233    connections are permitted.  
234
235 \item [FD Connect Timeout = \lt{}time\gt{}]
236    \index[dir]{FD Connect Timeout}
237    \index[dir]{Directive!FD Connect Timeout}
238    where {\bf time} is the time that the Director should continue
239    attempting to contact the File daemon to start a job, and after which
240    the Director will cancel the job.  The default is 30 minutes.
241
242 \item [SD Connect Timeout = \lt{}time\gt{}]
243    \index[dir]{SD Connect Timeout}
244    \index[dir]{Directive!SD Connect Timeout}
245    where {\bf time} is the time that the Director should continue
246    attempting to contact the Storage daemon to start a job, and after which
247    the Director will cancel the job.  The default is 30 minutes.
248
249 \item [DirAddresses = \lt{}IP-address-specification\gt{}]
250    \index[dir]{DirAddresses}
251    \index[dir]{Address}
252    \index[general]{Address}
253    \index[dir]{Directive!DirAddresses}
254    Specify the ports and addresses on which the Director daemon will listen
255    for Bacula Console connections.  Probably the simplest way to explain
256    this is to show an example:
257
258 \footnotesize
259 \begin{verbatim}
260  DirAddresses  = { 
261     ip = { addr = 1.2.3.4; port = 1205;}
262     ipv4 = {
263         addr = 1.2.3.4; port = http;}
264     ipv6 = {
265         addr = 1.2.3.4;
266         port = 1205;
267     }
268     ip = {
269         addr = 1.2.3.4
270         port = 1205
271     }
272     ip = { addr = 1.2.3.4 }
273     ip = { addr = 201:220:222::2 }
274     ip = {
275         addr = bluedot.thun.net
276     }
277 }
278 \end{verbatim}
279 \normalsize
280
281 where ip, ip4, ip6, addr, and port are all keywords. Note, that  the address
282 can be specified as either a dotted quadruple, or  IPv6 colon notation, or as
283 a symbolic name (only in the ip specification).  Also, port can be specified
284 as a number or as the mnemonic value from  the /etc/services file.  If a port
285 is not specified, the default will be used. If an ip  section is specified,
286 the resolution can be made either by IPv4 or  IPv6. If ip4 is specified, then
287 only IPv4 resolutions will be permitted,  and likewise with ip6. 
288
289 Please note that if you use the DirAddresses directive, you must
290 not use either a DirPort or a DirAddress directive in the same 
291 resource.
292
293 \item [DirPort = \lt{}port-number\gt{}]
294    \index[dir]{DirPort}
295    \index[dir]{Directive!DirPort}
296    Specify the port (a positive  integer) on which the  Director daemon will
297    listen for Bacula Console connections.  This same port number must be
298    specified in the Director resource  of the Console configuration file. The
299    default is 9101, so  normally this directive need not be specified.  This
300    directive should not be used if you specify DirAddresses (N.B plural)
301    directive.
302
303 \item [DirAddress = \lt{}IP-Address\gt{}]
304    \index[dir]{DirAddress}
305    \index[dir]{Directive!DirAddress}
306    This directive is optional, but if it is specified, it will cause the
307    Director server (for the Console program) to bind to the specified {\bf
308      IP-Address}, which is either a domain name or an IP address specified as a
309    dotted quadruple in string or quoted string format.  If this directive is
310    not specified, the Director will bind to any available address (the
311    default).  Note, unlike the DirAddresses specification noted above, this
312    directive only permits a single address to be specified.  This directive
313    should not be used if you specify a DirAddresses (N.B. plural) directive.
314
315 \item[Statistics Retention = \lt{}time\gt{}]
316    \index[dir]{StatisticsRetention}
317    \index[dir]{Directive!StatisticsRetention}
318    \label{PruneStatistics}
319
320    The \texttt{Statistics Retention} directive defines the length of time that
321    Bacula will keep statistics job records in the Catalog database after the
322    Job End time. (In \texttt{JobStat} table) When this time period expires, and
323    if user runs \texttt{prune stats} command, Bacula will prune (remove) Job
324    records that are older than the specified period.
325
326    Theses statistics records aren't use for restore purpose, but mainly for
327    capacity planning, billings, etc. See \ilink{Statistics chapter} for
328    additional information.
329
330    See the \ilink{ Configuration chapter}{Time} of this manual for additional
331    details of time specification.
332
333    The default is 5 years.
334
335 \end{description}
336
337 The following is an example of a valid Director resource definition: 
338
339 \footnotesize
340 \begin{verbatim}
341 Director {
342   Name = HeadMan
343   WorkingDirectory = "$HOME/bacula/bin/working"
344   Password = UA_password
345   PidDirectory = "$HOME/bacula/bin/working"
346   QueryFile = "$HOME/bacula/bin/query.sql"
347   Messages = Standard
348 }
349 \end{verbatim}
350 \normalsize
351
352 \section{The Job Resource}
353 \label{JobResource}
354 \index[general]{Resource!Job}
355 \index[general]{Job Resource}
356
357 The Job resource defines a Job (Backup, Restore, ...) that Bacula must
358 perform. Each Job resource definition contains the name of a Client and
359 a FileSet to backup, the Schedule for the Job, where the data
360 are to be stored, and what media Pool can be used. In effect, each Job
361 resource must specify What, Where, How, and When or FileSet, Storage,
362 Backup/Restore/Level, and Schedule respectively. Note, the FileSet must
363 be specified for a restore job for historical reasons, but it is no longer used.
364
365 Only a single type ({\bf Backup}, {\bf Restore}, ...) can be specified for any
366 job. If you want to backup multiple FileSets on the same Client or multiple
367 Clients, you must define a Job for each one. 
368
369 Note, you define only a single Job to do the Full, Differential, and
370 Incremental backups since the different backup levels are tied together by 
371 a unique Job name.  Normally, you will have only one Job per Client, but   
372 if a client has a really huge number of files (more than several million),
373 you might want to split it into to Jobs each with a different FileSet
374 covering only part of the total files.
375                
376
377 \begin{description}
378
379 \item [Job]
380    \index[dir]{Job}
381    \index[dir]{Directive!Job}
382    Start of the Job resource. At least one Job  resource is required. 
383
384 \item [Name = \lt{}name\gt{}]
385    \index[dir]{Name}
386    \index[dir]{Directive!Name}
387    The Job name. This name can be specified  on the {\bf Run} command in the
388    console program to start a job. If the  name contains spaces, it must be
389    specified between quotes. It is  generally a good idea to give your job the
390    same name as the Client  that it will backup. This permits easy
391    identification of jobs.  
392
393    When the job actually runs, the unique Job Name will consist  of the name you
394    specify here followed by the date and time the  job was scheduled for
395    execution. This directive is required. 
396
397 \item [Enabled = \lt{}yes|no\gt{}]
398   \index[dir]{Enable}
399   \index[dir]{Directive!Enable}
400   This directive allows you to enable or disable automatic execution
401   via the scheduler of a Job.
402
403 \item [Type = \lt{}job-type\gt{}]
404    \index[dir]{Type}
405    \index[dir]{Directive!Type}
406    The {\bf Type} directive specifies  the Job type, which may be one of the
407    following: {\bf Backup},  {\bf Restore}, {\bf Verify}, or {\bf Admin}. This
408    directive  is required. Within a particular Job Type, there are also Levels 
409    as discussed in the next item.  
410
411 \begin{description}
412
413 \item [Backup]
414    \index[dir]{Backup}
415    Run a backup Job. Normally you will  have at least one Backup job for each
416    client you want  to save. Normally, unless you turn off cataloging,  most all
417    the important statistics and data concerning  files backed up will be placed
418    in the catalog. 
419
420 \item [Restore]
421    \index[dir]{Restore}
422    Run a restore Job.  Normally, you will specify only one Restore job
423    which acts as a sort of prototype that you will modify using the console
424    program in order to perform restores.  Although certain basic
425    information from a Restore job is saved in the catalog, it is very
426    minimal compared to the information stored for a Backup job -- for
427    example, no File database entries are generated since no Files are
428    saved.
429
430    {\bf Restore} jobs cannot be
431    automatically started by the scheduler as is the case for Backup, Verify
432    and Admin jobs. To restore files, you must use the {\bf restore} command
433    in the console.
434
435
436 \item [Verify]
437    \index[dir]{Verify}
438    Run a verify Job. In general, {\bf verify}  jobs permit you to compare the
439    contents of the catalog  to the file system, or to what was backed up. In
440    addition,  to verifying that a tape that was written can be read,  you can
441    also use {\bf verify} as a sort of tripwire  intrusion detection.  
442
443 \item [Admin]
444    \index[dir]{Admin}
445    Run an admin Job. An {\bf Admin} job can  be used to periodically run catalog
446    pruning, if you  do not want to do it at the end of each {\bf Backup}  Job.
447    Although an Admin job is recorded in the  catalog, very little data is saved. 
448 \end{description}
449
450 \label{Level}
451
452 \item [Level = \lt{}job-level\gt{}]
453 \index[dir]{Level}
454 \index[dir]{Directive!Level}
455    The Level directive specifies the default Job level to be run.  Each
456    different Job Type (Backup, Restore, ...) has a different set of Levels
457    that can be specified.  The Level is normally overridden by a different
458    value that is specified in the {\bf Schedule} resource.  This directive
459    is not required, but must be specified either by a {\bf Level} directive
460    or as an override specified in the {\bf Schedule} resource.
461
462 For a {\bf Backup} Job, the Level may be one of the  following:  
463
464 \begin{description}
465
466 \item [Full]
467 \index[dir]{Full}
468    When the Level is set to Full all files in the FileSet whether or not
469    they have changed will be backed up.
470
471 \item [Incremental]
472    \index[dir]{Incremental}
473    When the Level is set to Incremental all files specified in the FileSet
474    that have changed since the last successful backup of the the same Job
475    using the same FileSet and Client, will be backed up.  If the Director
476    cannot find a previous valid Full backup then the job will be upgraded
477    into a Full backup.  When the Director looks for a valid backup record
478    in the catalog database, it looks for a previous Job with:
479
480 \begin{itemize}
481 \item The same Job name.  
482 \item The same Client name.  
483 \item The same FileSet (any change to the definition of  the FileSet such as
484    adding or deleting a file in the  Include or Exclude sections constitutes a
485    different FileSet.  
486 \item The Job was a Full, Differential, or Incremental backup.  
487 \item The Job terminated normally (i.e. did not fail or was not  canceled).  
488 \item The Job started no longer ago than {\bf Max Full Age}.
489 \end{itemize}
490
491    If all the above conditions do not hold, the Director will upgrade  the
492    Incremental to a Full save. Otherwise, the Incremental  backup will be
493    performed as requested.  
494
495    The File daemon (Client) decides which files to backup for an
496    Incremental backup by comparing start time of the prior Job (Full,
497    Differential, or Incremental) against the time each file was last
498    "modified" (st\_mtime) and the time its attributes were last
499    "changed"(st\_ctime).  If the file was modified or its attributes
500    changed on or after this start time, it will then be backed up.
501
502    Some virus scanning software may change st\_ctime while
503    doing the scan.  For example, if the virus scanning program attempts to
504    reset the access time (st\_atime), which Bacula does not use, it will
505    cause st\_ctime to change and hence Bacula will backup the file during
506    an Incremental or Differential backup.  In the case of Sophos virus
507    scanning, you can prevent it from resetting the access time (st\_atime)
508    and hence changing st\_ctime by using the {\bf \verb:--:no-reset-atime}
509    option.  For other software, please see their manual.
510
511    When Bacula does an Incremental backup, all modified files that are
512    still on the system are backed up.  However, any file that has been
513    deleted since the last Full backup remains in the Bacula catalog,
514    which means that if between a Full save and the time you do a
515    restore, some files are deleted, those deleted files will also be
516    restored.  The deleted files will no longer appear in the catalog
517    after doing another Full save.
518
519    In addition, if you move a directory rather than copy it, the files in
520    it do not have their modification time (st\_mtime) or their attribute
521    change time (st\_ctime) changed.  As a consequence, those files will
522    probably not be backed up by an Incremental or Differential backup which
523    depend solely on these time stamps.  If you move a directory, and wish
524    it to be properly backed up, it is generally preferable to copy it, then
525    delete the original.
526
527    However, to manage deleted files or directories changes in the
528    catalog during an Incremental backup you can use \texttt{accurate}
529    mode. This is quite memory consuming process. See \ilink{Accurate
530      mode}{accuratemode} for more details.
531
532 \item [Differential]
533    \index[dir]{Differential}
534    When the Level is set to Differential
535    all files specified in the FileSet that have changed since the last
536    successful Full backup of the same Job will be backed up.
537    If the Director cannot find a
538    valid previous Full backup for the same Job, FileSet, and Client,
539    backup, then the Differential job will be upgraded into a Full backup.
540    When the Director looks for a valid Full backup record in the catalog
541    database, it looks for a previous Job with:
542
543 \begin{itemize}
544 \item The same Job name.  
545 \item The same Client name.  
546 \item The same FileSet (any change to the definition of  the FileSet such as
547    adding or deleting a file in the  Include or Exclude sections constitutes a
548    different FileSet.  
549 \item The Job was a FULL backup.  
550 \item The Job terminated normally (i.e. did not fail or was not  canceled).  
551 \item The Job started no longer ago than {\bf Max Full Age}.
552 \end{itemize}
553
554    If all the above conditions do not hold, the Director will  upgrade the
555    Differential to a Full save. Otherwise, the  Differential backup will be
556    performed as requested.  
557
558    The File daemon (Client) decides which files to backup for a
559    differential backup by comparing the start time of the prior Full backup
560    Job against the time each file was last "modified" (st\_mtime) and the
561    time its attributes were last "changed" (st\_ctime).  If the file was
562    modified or its attributes were changed on or after this start time, it
563    will then be backed up.  The start time used is displayed after the {\bf
564    Since} on the Job report.  In rare cases, using the start time of the
565    prior backup may cause some files to be backed up twice, but it ensures
566    that no change is missed.  As with the Incremental option, you should
567    ensure that the clocks on your server and client are synchronized or as
568    close as possible to avoid the possibility of a file being skipped.
569    Note, on versions 1.33 or greater Bacula automatically makes the
570    necessary adjustments to the time between the server and the client so
571    that the times Bacula uses are synchronized.
572
573    When Bacula does a Differential backup, all modified files that are
574    still on the system are backed up.  However, any file that has been
575    deleted since the last Full backup remains in the Bacula catalog, which
576    means that if between a Full save and the time you do a restore, some
577    files are deleted, those deleted files will also be restored.  The
578    deleted files will no longer appear in the catalog after doing another
579    Full save.  However, to remove deleted files from the catalog during a
580    Differential backup is quite a time consuming process and not currently
581    implemented in Bacula.  It is, however, a planned future feature.
582
583    As noted above, if you move a directory rather than copy it, the
584    files in it do not have their modification time (st\_mtime) or
585    their attribute change time (st\_ctime) changed.  As a
586    consequence, those files will probably not be backed up by an
587    Incremental or Differential backup which depend solely on these
588    time stamps.  If you move a directory, and wish it to be
589    properly backed up, it is generally preferable to copy it, then
590    delete the original. Alternatively, you can move the directory, then
591    use the {\bf touch} program to update the timestamps.
592
593 %% TODO: merge this with incremental 
594    However, to manage deleted files or directories changes in the
595    catalog during an Differential backup you can use \texttt{accurate}
596    mode. This is quite memory consuming process. See \ilink{Accurate
597      mode}{accuratemode} for more details.
598
599    Every once and a while, someone asks why we need Differential
600    backups as long as Incremental backups pickup all changed files.
601    There are possibly many answers to this question, but the one
602    that is the most important for me is that a Differential backup
603    effectively merges
604    all the Incremental and Differential backups since the last Full backup
605    into a single Differential backup.  This has two effects: 1.  It gives
606    some redundancy since the old backups could be used if the merged backup
607    cannot be read.  2.  More importantly, it reduces the number of Volumes
608    that are needed to do a restore effectively eliminating the need to read
609    all the volumes on which the preceding Incremental and Differential
610    backups since the last Full are done.
611
612 \end{description}
613
614 For a {\bf Restore} Job, no level needs to be specified.  
615
616 For a {\bf Verify} Job, the Level may be one of the  following:  
617
618 \begin{description}
619
620 \item [InitCatalog]
621 \index[dir]{InitCatalog}
622    does a scan of the specified {\bf FileSet} and stores the file
623    attributes in the Catalog database.  Since no file data is saved, you
624    might ask why you would want to do this.  It turns out to be a very
625    simple and easy way to have a {\bf Tripwire} like feature using {\bf
626    Bacula}.  In other words, it allows you to save the state of a set of
627    files defined by the {\bf FileSet} and later check to see if those files
628    have been modified or deleted and if any new files have been added.
629    This can be used to detect system intrusion.  Typically you would
630    specify a {\bf FileSet} that contains the set of system files that
631    should not change (e.g.  /sbin, /boot, /lib, /bin, ...).  Normally, you
632    run the {\bf InitCatalog} level verify one time when your system is
633    first setup, and then once again after each modification (upgrade) to
634    your system.  Thereafter, when your want to check the state of your
635    system files, you use a {\bf Verify} {\bf level = Catalog}.  This
636    compares the results of your {\bf InitCatalog} with the current state of
637    the files.
638
639 \item [Catalog]
640 \index[dir]{Catalog}
641    Compares the current state of the files against the state previously
642    saved during an {\bf InitCatalog}.  Any discrepancies are reported.  The
643    items reported are determined by the {\bf verify} options specified on
644    the {\bf Include} directive in the specified {\bf FileSet} (see the {\bf
645    FileSet} resource below for more details).  Typically this command will
646    be run once a day (or night) to check for any changes to your system
647    files.
648
649    Please note!  If you run two Verify Catalog jobs on the same client at
650    the same time, the results will certainly be incorrect.  This is because
651    Verify Catalog modifies the Catalog database while running in order to
652    track new files.
653
654 \item [VolumeToCatalog]
655 \index[dir]{VolumeToCatalog}
656    This level causes Bacula to read the file attribute data written to the
657    Volume from the last Job.  The file attribute data are compared to the
658    values saved in the Catalog database and any differences are reported.
659    This is similar to the {\bf Catalog} level except that instead of
660    comparing the disk file attributes to the catalog database, the
661    attribute data written to the Volume is read and compared to the catalog
662    database.  Although the attribute data including the signatures (MD5 or
663    SHA1) are compared, the actual file data is not compared (it is not in
664    the catalog).
665
666    Please note!  If you run two Verify VolumeToCatalog jobs on the same
667    client at the same time, the results will certainly be incorrect.  This
668    is because the Verify VolumeToCatalog modifies the Catalog database
669    while running.
670
671 \item [DiskToCatalog]
672 \index[dir]{DiskToCatalog}
673    This level causes Bacula to read the files as they currently are on
674    disk, and to compare the current file attributes with the attributes
675    saved in the catalog from the last backup for the job specified on the
676    {\bf VerifyJob} directive.  This level differs from the {\bf Catalog}
677    level described above by the fact that it doesn't compare against a
678    previous Verify job but against a previous backup.  When you run this
679    level, you must supply the verify options on your Include statements.
680    Those options determine what attribute fields are compared.
681
682    This command can be very useful if you have disk problems because it
683    will compare the current state of your disk against the last successful
684    backup, which may be several jobs.
685
686    Note, the current implementation (1.32c) does not identify files that
687    have been deleted.
688 \end{description}
689
690 \item [Accurate = \lt{}yes|no\gt{}]
691 \index[dir]{Accurate}
692    In accurate mode, FileDaemon known exactly which files were present
693    after last backup. So it is able to handle deleted or renamed files.
694
695    When restoring a fileset for a specified date (including "most
696    recent"), Bacula is able to give you exactly the files and
697    directories that existed at the time of the last backup prior to
698    that date.
699
700    In this mode, FileDaemon have to keep all files in memory. So you have
701    to check that your memory and swap are sufficent.
702
703    $$ memory = \sum_{i=1}^{n}(strlen(path_i + file_i) + sizeof(CurFile))$$
704
705    For 500.000 files (typical desktop linux system), it will take
706    around 64MB of RAM on your FileDaemon.
707
708 \item [Verify Job = \lt{}Job-Resource-Name\gt{}]
709    \index[dir]{Verify Job}
710    \index[dir]{Directive!Verify Job}
711    If you run a verify job without this directive, the last job run will be
712    compared with the catalog, which means that you must immediately follow
713    a backup by a verify command.  If you specify a {\bf Verify Job} Bacula
714    will find the last job with that name that ran.  This permits you to run
715    all your backups, then run Verify jobs on those that you wish to be
716    verified (most often a {\bf VolumeToCatalog}) so that the tape just
717    written is re-read.
718
719 \item [JobDefs = \lt{}JobDefs-Resource-Name\gt{}]
720 \index[dir]{JobDefs}
721 \index[dir]{Directive!JobDefs}
722    If a JobDefs-Resource-Name is specified, all the values contained in the
723    named JobDefs resource will be used as the defaults for the current Job.
724    Any value that you explicitly define in the current Job resource, will
725    override any defaults specified in the JobDefs resource.  The use of
726    this directive permits writing much more compact Job resources where the
727    bulk of the directives are defined in one or more JobDefs.  This is
728    particularly useful if you have many similar Jobs but with minor
729    variations such as different Clients.  A simple example of the use of
730    JobDefs is provided in the default bacula-dir.conf file.
731
732 \item [Bootstrap = \lt{}bootstrap-file\gt{}]
733 \index[dir]{Bootstrap}
734 \index[dir]{Directive!Bootstrap}
735    The Bootstrap directive specifies a bootstrap file that, if provided,
736    will be used during {\bf Restore} Jobs and is ignored in other Job
737    types.  The {\bf bootstrap} file contains the list of tapes to be used
738    in a restore Job as well as which files are to be restored.
739    Specification of this directive is optional, and if specified, it is
740    used only for a restore job.  In addition, when running a Restore job
741    from the console, this value can be changed.
742
743    If you use the {\bf Restore} command in the Console program, to start a
744    restore job, the {\bf bootstrap} file will be created automatically from
745    the files you select to be restored.
746
747    For additional details of the {\bf bootstrap} file, please see
748    \ilink{Restoring Files with the Bootstrap File}{BootstrapChapter} chapter
749    of this manual.
750
751 \label{writebootstrap}
752 \item [Write Bootstrap =  \lt{}bootstrap-file-specification\gt{}]
753 \index[dir]{Write Bootstrap}
754 \index[dir]{Directive!Write Bootstrap}
755    The {\bf writebootstrap} directive specifies a file name where Bacula
756    will write a {\bf bootstrap} file for each Backup job run.  This
757    directive applies only to Backup Jobs.  If the Backup job is a Full
758    save, Bacula will erase any current contents of the specified file
759    before writing the bootstrap records.  If the Job is an Incremental
760    or Differential
761    save, Bacula will append the current bootstrap record to the end of the
762    file.
763
764    Using this feature, permits you to constantly have a bootstrap file that
765    can recover the current state of your system.  Normally, the file
766    specified should be a mounted drive on another machine, so that if your
767    hard disk is lost, you will immediately have a bootstrap record
768    available.  Alternatively, you should copy the bootstrap file to another
769    machine after it is updated. Note, it is a good idea to write a separate
770    bootstrap file for each Job backed up including the job that backs up
771    your catalog database.
772
773    If the {\bf bootstrap-file-specification} begins with a vertical bar
774    (|), Bacula will use the specification as the name of a program to which
775    it will pipe the bootstrap record.  It could for example be a shell
776    script that emails you the bootstrap record.
777
778    On versions 1.39.22 or greater, before opening the file or executing the
779    specified command, Bacula performs 
780    \ilink{character substitution}{character substitution} like in RunScript
781    directive. To automatically manage your bootstrap files, you can use
782    this in your {\bf JobDefs} resources:
783 \begin{verbatim}
784 JobDefs {
785    Write Bootstrap = "%c_%n.bsr"
786    ...
787 }
788 \end{verbatim}
789
790    For more details on using this file, please see the chapter entitled
791    \ilink{The Bootstrap File}{BootstrapChapter} of this manual.
792
793 \item [Client = \lt{}client-resource-name\gt{}]
794 \index[dir]{Client}
795 \index[dir]{Directive!Client}
796    The Client directive  specifies the Client (File daemon) that will be used in
797    the  current Job. Only a single Client may be specified in any one Job.  The
798    Client runs on the machine to be backed up,  and sends the requested files to
799    the Storage daemon for backup,  or receives them when restoring. For
800    additional details, see the  
801    \ilink{Client Resource section}{ClientResource2} of this chapter.
802    This directive is required. 
803
804 \item [FileSet = \lt{}FileSet-resource-name\gt{}]
805 \index[dir]{FileSet}
806 \index[dir]{FileSet}
807    The FileSet directive specifies the FileSet that will be used in the
808    current Job.  The FileSet specifies which directories (or files) are to
809    be backed up, and what options to use (e.g.  compression, ...).  Only a
810    single FileSet resource may be specified in any one Job.  For additional
811    details, see the \ilink{FileSet Resource section}{FileSetResource} of
812    this chapter.  This directive is required.
813
814 \item [Messages = \lt{}messages-resource-name\gt{}]
815 \index[dir]{Messages}
816 \index[dir]{Directive!Messages}
817    The Messages directive defines what Messages resource should be used for
818    this job, and thus how and where the various messages are to be
819    delivered.  For example, you can direct some messages to a log file, and
820    others can be sent by email.  For additional details, see the
821    \ilink{Messages Resource}{MessagesChapter} Chapter of this manual.  This
822    directive is required.
823
824 \item [Pool = \lt{}pool-resource-name\gt{}]
825 \index[dir]{Pool}
826 \index[dir]{Directive!Pool}
827    The Pool directive defines the pool of Volumes where your data can be
828    backed up.  Many Bacula installations will use only the {\bf Default}
829    pool.  However, if you want to specify a different set of Volumes for
830    different Clients or different Jobs, you will probably want to use
831    Pools.  For additional details, see the \ilink{Pool Resource
832    section}{PoolResource} of this chapter.  This directive is required.
833
834 \item [Full Backup Pool = \lt{}pool-resource-name\gt{}]
835 \index[dir]{Full Backup Pool}
836 \index[dir]{Directive!Full Backup Pool}
837    The {\it Full Backup Pool} specifies a Pool to be used for Full backups.
838    It will override any Pool specification during a Full backup.  This
839    directive is optional.
840    
841 \item [Differential Backup Pool = \lt{}pool-resource-name\gt{}]  
842 \index[dir]{Differential Backup Pool}
843 \index[dir]{Directive!Differential Backup Pool}
844    The {\it Differential Backup Pool} specifies a Pool to be used for
845    Differential backups.  It will override any Pool specification during a
846    Differential backup.  This directive is optional.
847    
848 \item [Incremental Backup Pool = \lt{}pool-resource-name\gt{}]  
849 \index[dir]{Incremental Backup Pool}
850 \index[dir]{Directive!Incremental Backup Pool}
851    The {\it Incremental Backup Pool} specifies a Pool to be used for
852    Incremental backups.  It will override any Pool specification during an
853    Incremental backup.  This directive is optional.
854
855 \item [Schedule = \lt{}schedule-name\gt{}]
856 \index[dir]{Schedule}
857 \index[dir]{Directive!Schedule}
858    The Schedule directive defines what schedule is to be used for the Job.
859    The schedule in turn determines when the Job will be automatically
860    started and what Job level (i.e.  Full, Incremental, ...) is to be run.
861    This directive is optional, and if left out, the Job can only be started
862    manually using the Console program.  Although you may specify only a
863    single Schedule resource for any one job, the Schedule resource may
864    contain multiple {\bf Run} directives, which allow you to run the Job at
865    many different times, and each {\bf run} directive permits overriding
866    the default Job Level Pool, Storage, and Messages resources.  This gives
867    considerable flexibility in what can be done with a single Job.  For
868    additional details, see the \ilink{Schedule Resource
869    Chapter}{ScheduleResource} of this manual.
870           
871
872 \item [Storage = \lt{}storage-resource-name\gt{}]
873 \index[dir]{Storage}
874 \index[dir]{Directive!Storage}
875    The Storage directive defines the name of the storage services where you
876    want to backup the FileSet data.  For additional details, see the
877    \ilink{Storage Resource Chapter}{StorageResource2} of this manual.
878    The Storage resource may also be specified in the Job's Pool resource,
879    in which case the value in the Pool resource overrides any value
880    in the Job. This Storage resource definition is not required by either
881    the Job resource or in the Pool, but it must be specified in
882    one or the other, if not an error will result.
883
884 \item [Max Start Delay = \lt{}time\gt{}]
885 \index[dir]{Max Start Delay}
886 \index[dir]{Directive!Max Start Delay}
887    The time specifies the maximum delay between the scheduled time and the
888    actual start time for the Job.  For example, a job can be scheduled to
889    run at 1:00am, but because other jobs are running, it may wait to run.
890    If the delay is set to 3600 (one hour) and the job has not begun to run
891    by 2:00am, the job will be canceled.  This can be useful, for example,
892    to prevent jobs from running during day time hours.  The default is 0
893    which indicates no limit.
894
895 \item [Max Run Time = \lt{}time\gt{}]
896 \index[dir]{Max Run Time}
897 \index[dir]{Directive!Max Run Time}
898    The time specifies the maximum allowed time that a job may run, counted
899    from when the job starts, ({\bf not} necessarily the same as when the
900    job was scheduled).
901
902 \item [Incremental|Differential Max Wait Time = \lt{}time\gt{}]
903 \index[dir]{Incremental Wait Run Time}
904 \index[dir]{Differential Wait Run Time}
905 \index[dir]{Directive!Differential Max Wait Time}
906     Theses directives have been deprecated in favor of
907     \texttt{Incremental|Differential Max Run Time} since bacula 2.3.18.
908
909 \item [Incremental Max Run Time = \lt{}time\gt{}]
910 \index[dir]{Incremental Max Run Time}
911 \index[dir]{Directive!Incremental Max Run Time}
912 The time specifies the maximum allowed time that an Incremental backup job may
913 run, counted from when the job starts, ({\bf not} necessarily the same as when
914 the job was scheduled).
915
916 \item [Differential Max Wait Time = \lt{}time\gt{}]
917 \index[dir]{Differential Max Run Time}
918 \index[dir]{Directive!Differential Max Run Time}
919 The time specifies the maximum allowed time that a Differential backup job may
920 run, counted from when the job starts, ({\bf not} necessarily the same as when
921 the job was scheduled).
922
923 \item [Max Run Sched Time = \lt{}time\gt{}]
924 \index[dir]{Max Run Sched Time}
925 \index[dir]{Directive!Max Run Sched Time}
926
927 The time specifies the maximum allowed time that a job may run, counted from
928 when the job was scheduled. This can be useful to prevent jobs from running
929 during working hours. We can see it like \texttt{Max Start Delay + Max Run
930   Time}.
931
932 \item [Max Wait Time = \lt{}time\gt{}]
933 \index[dir]{Max Wait Time}
934 \index[dir]{Directive!Max Wait Time}
935    The time specifies the maximum allowed time that a job may block waiting
936    for a resource (such as waiting for a tape to be mounted, or waiting for
937    the storage or file daemons to perform their duties), counted from the
938    when the job starts, ({\bf not} necessarily the same as when the job was
939    scheduled). This directive works as expected since bacula 2.3.18.
940
941 \item [Max Full Age = \lt{}time\gt{}]
942 \index[dir]{Max Full Age}
943 \index[dir]{Directive!Max Full Age}
944    The time specifies the maximum allowed age (counting from start time) of
945    the most recent successful Full backup that is required in order to run
946    Incremental or Differential backup jobs. If the most recent Full backup
947    is older than this interval, Incremental and Differential backups will be
948    upgraded to Full backups automatically. If this directive is not present,
949    or specified as 0, then the age of the previous Full backup is not
950    considered.
951
952 \label{PreferMountedVolumes}
953 \item [Prefer Mounted Volumes = \lt{}yes|no\gt{}]
954 \index[dir]{Prefer Mounted Volumes}
955 \index[dir]{Directive!Prefer Mounted Volumes}
956    If the Prefer Mounted Volumes directive is set to {\bf yes} (default
957    yes), the Storage daemon is requested to select either an Autochanger or
958    a drive with a valid Volume already mounted in preference to a drive
959    that is not ready.  This means that all jobs will attempt to append
960    to the same Volume (providing the Volume is appropriate -- right Pool, 
961    ... for that job). If no drive with a suitable Volume is available, it
962    will select the first available drive.  Note, any Volume that has
963    been requested to be mounted, will be considered valid as a mounted
964    volume by another job.  This if multiple jobs start at the same time
965    and they all prefer mounted volumes, the first job will request the
966    mount, and the other jobs will use the same volume.
967
968    If the directive is set to {\bf no}, the Storage daemon will prefer
969    finding an unused drive, otherwise, each job started will append to the
970    same Volume (assuming the Pool is the same for all jobs).  Setting
971    Prefer Mounted Volumes to no can be useful for those sites
972    with multiple drive autochangers that prefer to maximize backup
973    throughput at the expense of using additional drives and Volumes. 
974    This means that the job will prefer to use an unused drive rather
975    than use a drive that is already in use.
976
977 \item [Prune Jobs = \lt{}yes|no\gt{}]
978 \index[dir]{Prune Jobs}
979 \index[dir]{Directive!Prune Jobs}
980    Normally, pruning of Jobs from the Catalog is specified on a Client by
981    Client basis in the Client resource with the {\bf AutoPrune} directive.
982    If this directive is specified (not normally) and the value is {\bf
983    yes}, it will override the value specified in the Client resource.  The
984    default is {\bf no}.
985
986
987 \item [Prune Files = \lt{}yes|no\gt{}]
988 \index[dir]{Prune Files}
989 \index[dir]{Directive!Prune Files}
990    Normally, pruning of Files from the Catalog is specified on a Client by
991    Client basis in the Client resource with the {\bf AutoPrune} directive.
992    If this directive is specified (not normally) and the value is {\bf
993    yes}, it will override the value specified in the Client resource.  The
994    default is {\bf no}.
995
996 \item [Prune Volumes = \lt{}yes|no\gt{}]
997 \index[dir]{Prune Volumes}
998 \index[dir]{Directive!Prune Volumes}
999    Normally, pruning of Volumes from the Catalog is specified on a Client
1000    by Client basis in the Client resource with the {\bf AutoPrune}
1001    directive.  If this directive is specified (not normally) and the value
1002    is {\bf yes}, it will override the value specified in the Client
1003    resource.  The default is {\bf no}.
1004
1005 \item [RunScript \{\lt{}body-of-runscript\gt{}\}]
1006    \index[dir]{RunScript}
1007    \index[dir]{Directive!Run Script}
1008
1009    This directive is implemented in version 1.39.22 and later.
1010    The RunScript directive behaves like a resource in that it
1011    requires opening and closing braces around a number of directives
1012    that make up the body of the runscript.
1013
1014    The specified {\bf Command} (see below for details) is run as an
1015    external program prior or after the current Job.  This is optional.
1016
1017    Console options are special commands that are sent to the director instead
1018    of the OS.
1019
1020    You can specify more than one Command/Console option per RunScript.
1021
1022    You can use following options may be specified in the body
1023    of the runscript:\\
1024
1025 \begin{tabular}{|c|c|c|l}
1026 Options         & Value  & Default & Information   \\
1027 \hline
1028 \hline
1029 Runs On Success & Yes/No & {\it Yes} & Run command if JobStatus is successful\\
1030 \hline
1031 Runs On Failure & Yes/No & {\it No} & Run command if JobStatus isn't successful\\
1032 \hline
1033 Runs On Client  & Yes/No & {\it Yes} & Run command on client\\
1034 \hline
1035 Runs When       & Before|After|Always|\textsl{AfterVSS} & {\it Never} & When run commands\\
1036 \hline
1037 Fail Job On Error & Yes/No & {\it Yes} & Fail job if script returns 
1038                                           something different from 0 \\
1039 \hline
1040 Command          &       &          & Path to your script\\
1041 \hline
1042 Console          &       &          & Console command\\
1043 \hline
1044 \end{tabular}
1045    \\
1046
1047    Any output sent by the command to standard output will be included in the
1048    Bacula job report.  The command string must be a valid program name or name
1049    of a shell script.
1050
1051    In addition, the command string is parsed then fed to the OS,
1052    which means that the path will be searched to execute your specified
1053    command, but there is no shell interpretation, as a consequence, if you
1054    invoke complicated commands or want any shell features such as redirection
1055    or piping, you must call a shell script and do it inside that script.
1056  
1057    Before submitting the specified command to the operating system, Bacula
1058    performs character substitution of the following characters:
1059
1060 \label{character substitution}
1061 \footnotesize
1062 \begin{verbatim}
1063     %% = %
1064     %c = Client's name
1065     %d = Director's name
1066     %e = Job Exit Status
1067     %i = JobId
1068     %j = Unique Job id
1069     %l = Job Level
1070     %n = Job name
1071     %s = Since time
1072     %t = Job type (Backup, ...)
1073     %v = Volume name (Only on director side)
1074  
1075 \end{verbatim}
1076 \normalsize
1077
1078 The Job Exit Status code \%e edits the following values:
1079
1080 \index[dir]{Exit Status}
1081 \begin{itemize}
1082 \item OK
1083 \item Error
1084 \item Fatal Error
1085 \item Canceled
1086 \item Differences
1087 \item Unknown term code
1088 \end{itemize}
1089
1090    Thus if you edit it on a command line, you will need to enclose 
1091    it within some sort of quotes.
1092
1093
1094 You can use these following shortcuts:\\
1095
1096 \begin{tabular}{|c|c|c|c|c|c}
1097 Keyword & RunsOnSuccess & RunsOnFailure  & FailJobOnError & Runs On Client & RunsWhen  \\
1098 \hline
1099 Run Before Job         &        &       & Yes     & No     & Before \\
1100 \hline
1101 Run After Job          &  Yes   &   No  &         & No     & After  \\
1102 \hline
1103 Run After Failed Job   &  No    &  Yes  &         & No     & After  \\
1104 \hline
1105 Client Run Before Job  &        &       & Yes     & Yes    & Before \\
1106 \hline
1107 Client Run After Job   &  Yes   &   No  &         & Yes    & After  \\
1108 \end{tabular}
1109
1110 Examples:
1111 \begin{verbatim}
1112 RunScript {
1113     RunsWhen = Before
1114     FailJobOnError = No
1115     Command = "/etc/init.d/apache stop"
1116 }
1117
1118 RunScript {
1119     RunsWhen = After
1120     RunsOnFailure = yes
1121     Command = "/etc/init.d/apache start"
1122 }
1123 \end{verbatim}
1124
1125    {\bf Notes about ClientRunBeforeJob}
1126
1127    For compatibility reasons, with this shortcut, the command is executed
1128    directly when the client recieve it. And if the command is in error, other
1129    remote runscripts will be discarded. To be sure that all commands will be
1130    sent and executed, you have to use RunScript syntax.
1131
1132    {\bf Special Windows Considerations}
1133
1134    You can run scripts just after snapshots initializations with
1135    \textsl{AfterVSS} keyword.
1136
1137    In addition, for a Windows client on version 1.33 and above, please take
1138    note that you must ensure a correct path to your script.  The script or
1139    program can be a .com, .exe or a .bat file.  If you just put the program
1140    name in then Bacula will search using the same rules that cmd.exe uses
1141    (current directory, Bacula bin directory, and PATH).  It will even try the
1142    different extensions in the same order as cmd.exe.
1143    The command can be anything that cmd.exe or command.com will recognize
1144    as an executable file.  
1145
1146    However, if you have slashes in the program name then Bacula figures you
1147    are fully specifying the name, so you must also explicitly add the three
1148    character extension.
1149
1150    The command is run in a Win32 environment, so Unix like commands will not
1151    work unless you have installed and properly configured Cygwin in addition
1152    to and separately from Bacula.
1153    
1154    The System \%Path\% will be searched for the command.  (under the
1155    environment variable dialog you have have both System Environment and
1156    User Environment, we believe that only the System environment will be
1157    available to bacula-fd, if it is running as a service.)
1158    
1159    System environment variables can be referenced with \%var\% and
1160    used as either part of the command name or arguments.  
1161
1162    So if you have a script in the Bacula\\bin directory then the following lines
1163    should work fine:
1164    
1165 \footnotesize
1166 \begin{verbatim}
1167         Client Run Before Job = systemstate
1168 or
1169         Client Run Before Job = systemstate.bat
1170 or
1171         Client Run Before Job = "systemstate"
1172 or
1173         Client Run Before Job = "systemstate.bat"
1174 or
1175         ClientRunBeforeJob = "\"C:/Program Files/Bacula/systemstate.bat\""
1176 \end{verbatim}
1177 \normalsize
1178
1179 The outer set of quotes is removed when the configuration file is parsed.
1180 You need to escape the inner quotes so that they are there when the code
1181 that parses the command line for execution runs so it can tell what the
1182 program name is.
1183
1184
1185 \footnotesize
1186 \begin{verbatim}
1187 ClientRunBeforeJob = "\"C:/Program Files/Software
1188      Vendor/Executable\" /arg1 /arg2 \"foo bar\""
1189 \end{verbatim}
1190 \normalsize
1191
1192    The special characters 
1193 \begin{verbatim}
1194 &<>()@^|
1195 \end{verbatim}
1196    will need to be quoted,
1197    if they are part of a filename or argument.
1198    
1199    If someone is logged in, a blank "command" window running the commands
1200    will be present during the execution of the command.
1201    
1202    Some Suggestions from Phil Stracchino for running on Win32 machines with
1203    the native Win32 File daemon:
1204
1205    \begin{enumerate}
1206    \item You might want the ClientRunBeforeJob directive to specify a .bat
1207       file which runs the actual client-side commands, rather than trying
1208       to run (for example) regedit /e directly.
1209    \item The batch file should explicitly 'exit 0' on successful completion.  
1210    \item The path to the batch file should be specified in Unix form:  
1211    
1212       ClientRunBeforeJob = "c:/bacula/bin/systemstate.bat"  
1213    
1214    rather than DOS/Windows form:  
1215    
1216    ClientRunBeforeJob =
1217
1218 "c:\textbackslash{}bacula\textbackslash{}bin\textbackslash{}systemstate.bat"
1219    INCORRECT 
1220    \end{enumerate}
1221
1222 For Win32, please note that there are certain limitations:  
1223
1224 ClientRunBeforeJob = "C:/Program Files/Bacula/bin/pre-exec.bat"
1225
1226 Lines like the above do not work because there are limitations of
1227 cmd.exe that is used to execute the command.
1228 Bacula prefixes the string you supply with {\bf cmd.exe /c }.  To test that
1229 your command works you should type {\bf cmd /c "C:/Program Files/test.exe"} at a
1230 cmd prompt and see what happens.  Once the command is correct insert a
1231 backslash (\textbackslash{}) before each double quote ("), and
1232 then put quotes around the whole thing when putting it in
1233 the director's .conf file.  You either need to have only one set of quotes
1234 or else use the short name and don't put quotes around the command path.
1235  
1236 Below is the output from cmd's help as it relates to the command line
1237 passed to the /c option.
1238  
1239  
1240  If /C or /K is specified, then the remainder of the command line after
1241  the switch is processed as a command line, where the following logic is
1242  used to process quote (") characters:
1243  
1244 \begin{enumerate}
1245 \item 
1246      If all of the following conditions are met, then quote characters
1247          on the command line are preserved:
1248     \begin{itemize}
1249        \item no /S switch.
1250        \item exactly two quote characters.
1251        \item no special characters between the two quote characters,
1252            where special is one of: 
1253 \begin{verbatim}
1254 &<>()@^| 
1255 \end{verbatim}
1256        \item there are one or more whitespace characters between the
1257            the two quote characters.
1258        \item the string between the two quote characters is the name
1259            of an executable file.
1260     \end{itemize}
1261  
1262 \item  Otherwise, old behavior is to see if the first character is
1263          a quote character and if so, strip the leading character and
1264          remove the last quote character on the command line, preserving
1265          any text after the last quote character. 
1266    
1267 \end{enumerate}
1268
1269    
1270 The following example of the use of the Client Run Before Job directive was 
1271 submitted by a user:\\
1272 You could write a shell script to back up a DB2 database to a FIFO. The shell
1273 script is:
1274
1275 \footnotesize
1276 \begin{verbatim}
1277  #!/bin/sh
1278  # ===== backupdb.sh
1279  DIR=/u01/mercuryd
1280  
1281  mkfifo $DIR/dbpipe
1282  db2 BACKUP DATABASE mercuryd TO $DIR/dbpipe WITHOUT PROMPTING &
1283  sleep 1
1284 \end{verbatim}
1285 \normalsize
1286  
1287 The following line in the Job resource in the bacula-dir.conf file:
1288 \footnotesize
1289 \begin{verbatim}
1290  Client Run Before Job = "su - mercuryd -c \"/u01/mercuryd/backupdb.sh '%t'
1291 '%l'\""
1292 \end{verbatim}
1293 \normalsize
1294
1295 When the job is run, you will get messages from the output of the script
1296 stating that the backup has started. Even though the command being run is
1297 backgrounded with \&, the job will block until the "db2 BACKUP DATABASE"
1298 command, thus the backup stalls.
1299  
1300 To remedy this situation, the "db2 BACKUP DATABASE" line should be changed to
1301 the following:
1302  
1303 \footnotesize
1304 \begin{verbatim} 
1305  db2 BACKUP DATABASE mercuryd TO $DIR/dbpipe WITHOUT PROMPTING > $DIR/backup.log
1306 2>&1 < /dev/null &
1307 \end{verbatim}
1308 \normalsize
1309
1310 It is important to redirect the input and outputs of a backgrounded command to
1311 /dev/null to prevent the script from blocking.
1312
1313 \item [Run Before Job = \lt{}command\gt{}]
1314 \index[dir]{Run Before Job}
1315 \index[dir]{Directive!Run Before Job}
1316 \index[dir]{Directive!Run Before Job}
1317 The specified {\bf command} is run as an external program prior to running the
1318 current Job.  This directive is not required, but if it is defined, and if the
1319 exit code of the program run is non-zero, the current Bacula job will be
1320 canceled.
1321
1322 \begin{verbatim}
1323 Run Before Job = "echo test"
1324 \end{verbatim}
1325    it's equivalent to :
1326 \begin{verbatim}
1327 RunScript {
1328  Command = "echo test"
1329  RunsOnClient = No
1330  RunsWhen = Before
1331 }
1332 \end{verbatim} 
1333
1334    Lutz Kittler has pointed out that using the RunBeforeJob directive can be a
1335    simple way to modify your schedules during a holiday.  For example, suppose
1336    that you normally do Full backups on Fridays, but Thursday and Friday are
1337    holidays.  To avoid having to change tapes between Thursday and Friday when
1338    no one is in the office, you can create a RunBeforeJob that returns a
1339    non-zero status on Thursday and zero on all other days.  That way, the
1340    Thursday job will not run, and on Friday the tape you inserted on Wednesday
1341    before leaving will be used.
1342
1343 \item [Run After Job = \lt{}command\gt{}]
1344 \index[dir]{Run After Job}
1345 \index[dir]{Directive!Run After Job}
1346    The specified {\bf command} is run as an external program if the current
1347    job terminates normally (without error or without being canceled).  This
1348    directive is not required.  If the exit code of the program run is
1349    non-zero, Bacula will print a warning message.  Before submitting the
1350    specified command to the operating system, Bacula performs character
1351    substitution as described above for the {\bf RunScript} directive.
1352    
1353    An example of the use of this directive is given in the  
1354    \ilink{Tips Chapter}{JobNotification} of this manual.  
1355
1356    See the {\bf Run After Failed Job} if you
1357    want to run a script after the job has terminated with any
1358    non-normal status.
1359
1360 \item [Run After Failed Job = \lt{}command\gt{}]
1361 \index[dir]{Run After Job}
1362 \index[dir]{Directive!Run After Job}
1363    The specified {\bf command} is run as an external program after the current
1364    job terminates with any error status.  This directive is not required.  The
1365    command string must be a valid program name or name of a shell script. If
1366    the exit code of the program run is non-zero, Bacula will print a
1367    warning message. Before submitting the specified command to the
1368    operating system, Bacula performs character substitution as described above
1369    for the {\bf RunScript} directive. Note, if you wish that your script
1370    will run regardless of the exit status of the Job, you can use this :
1371 \begin{verbatim}
1372 RunScript {
1373  Command = "echo test"
1374  RunsWhen = After
1375  RunsOnFailure = yes
1376  RunsOnClient  = no
1377  RunsOnSuccess = yes    # default, you can drop this line
1378 }
1379 \end{verbatim}
1380
1381    An example of the use of this directive is given in the  
1382    \ilink{Tips Chapter}{JobNotification} of this manual.
1383   
1384
1385 \item [Client Run Before Job = \lt{}command\gt{}]
1386 \index[dir]{Client Run Before Job}
1387 \index[dir]{Directive!Client Run Before Job}
1388    This directive is the same as {\bf Run Before Job} except that the
1389    program is run on the client machine.  The same restrictions apply to
1390    Unix systems as noted above for the {\bf RunScript}.
1391
1392 \item [Client Run After Job = \lt{}command\gt{}]
1393    \index[dir]{Client Run After Job}
1394    \index[dir]{Directive!Client Run After Job}
1395    The specified {\bf command} is run on the client machine as soon
1396    as data spooling is complete in order to allow restarting applications
1397    on the client as soon as possible. .
1398
1399    Note, please see the notes above in {\bf RunScript} 
1400    concerning Windows clients.
1401
1402 \item [Rerun Failed Levels = \lt{}yes|no\gt{}]
1403    \index[dir]{Rerun Failed Levels}
1404    \index[dir]{Directive!Rerun Failed Levels}
1405    If this directive is set to {\bf yes} (default no), and Bacula detects that
1406    a previous job at a higher level (i.e.  Full or Differential) has failed,
1407    the current job level will be upgraded to the higher level.  This is
1408    particularly useful for Laptops where they may often be unreachable, and if
1409    a prior Full save has failed, you wish the very next backup to be a Full
1410    save rather than whatever level it is started as.
1411
1412    There are several points that must be taken into account when using this
1413    directive: first, a failed job is defined as one that has not terminated
1414    normally, which includes any running job of the same name (you need to
1415    ensure that two jobs of the same name do not run simultaneously);
1416    secondly, the {\bf Ignore FileSet Changes} directive is not considered 
1417    when checking for failed levels, which means that any FileSet change will
1418    trigger a rerun.
1419
1420 \item [Spool Data = \lt{}yes|no\gt{}]
1421    \index[dir]{Spool Data}
1422    \index[dir]{Directive!Spool Data}
1423
1424    If this directive is set  to {\bf yes} (default no), the Storage daemon will
1425    be requested  to spool the data for this Job to disk rather than write it 
1426    directly to tape. Once all the data arrives or the spool files' maximum sizes
1427    are reached, the data will be despooled and written  to tape. Spooling data 
1428    prevents tape  shoe-shine (start and stop) during
1429    Incremental saves. If you are writing to a disk file using this option
1430    will probably just slow down the backup jobs.
1431
1432    NOTE: When this directive is set to yes, Spool Attributes is also
1433    automatically set to yes.
1434
1435 \item [Spool Attributes = \lt{}yes|no\gt{}]
1436    \index[dir]{Spool Attributes}
1437    \index[dir]{Directive!Spool Attributes}
1438    \index[dir]{slow}
1439    \index[general]{slow}
1440    \index[dir]{Backups!slow}
1441    \index[general]{Backups!slow}
1442    The default is set to {\bf no}, which means that the File attributes are
1443    sent by the Storage daemon to the Director as they are stored on tape.
1444    However, if you want to avoid the possibility that database updates will
1445    slow down writing to the tape, you may want to set the value to {\bf
1446    yes}, in which case the Storage daemon will buffer the File attributes
1447    and Storage coordinates to a temporary file in the Working Directory,
1448    then when writing the Job data to the tape is completed, the attributes
1449    and storage coordinates will be sent to the Director.
1450
1451    NOTE: When Spool Data is set to yes, Spool Attributes is also
1452    automatically set to yes.
1453
1454 \item [Where = \lt{}directory\gt{}]
1455    \index[dir]{Where}
1456    \index[dir]{Directive!Where}
1457    This directive applies only to a Restore job and specifies a prefix to
1458    the directory name of all files being restored.  This permits files to
1459    be restored in a different location from which they were saved.  If {\bf
1460    Where} is not specified or is set to backslash ({\bf /}), the files will
1461    be restored to their original location.  By default, we have set {\bf
1462    Where} in the example configuration files to be {\bf
1463    /tmp/bacula-restores}.  This is to prevent accidental overwriting of
1464    your files.
1465
1466 \item [Add Prefix = \lt{}directory\gt{}]
1467   \label{confaddprefix}
1468   \index[dir]{AddPrefix}
1469   \index[dir]{Directive!AddPrefix}
1470   This directive applies only to a Restore job and specifies a prefix to the
1471   directory name of all files being restored.  This will use \ilink{File
1472   Relocation}{filerelocation} feature implemented in Bacula 2.1.8 or later.  
1473
1474 \item [Add Suffix = \lt{}extention\gt{}]
1475   \index[dir]{AddSuffix}
1476   \index[dir]{Directive!AddSuffix}
1477   This directive applies only to a Restore job and specifies a suffix to all
1478   files being restored.  This will use \ilink{File Relocation}{filerelocation}
1479   feature implemented in Bacula 2.1.8 or later.
1480
1481   Using \texttt{Add Suffix=.old}, \texttt{/etc/passwd} will be restored to
1482   \texttt{/etc/passwsd.old}
1483
1484 \item [Strip Prefix = \lt{}directory\gt{}]
1485   \index[dir]{StripPrefix}
1486   \index[dir]{Directive!StripPrefix}
1487   This directive applies only to a Restore job and specifies a prefix to remove
1488   from the directory name of all files being restored.  This will use the
1489   \ilink{File Relocation}{filerelocation} feature implemented in Bacula 2.1.8 
1490   or later.
1491
1492   Using \texttt{Strip Prefix=/etc}, \texttt{/etc/passwd} will be restored to
1493   \texttt{/passwd}
1494
1495   Under Windows, if you want to restore \texttt{c:/files} to \texttt{d:/files},
1496   you can use :
1497
1498 \begin{verbatim}
1499  Strip Prefix = c:
1500  Add Prefix = d:
1501 \end{verbatim}
1502
1503 \item [RegexWhere = \lt{}expressions\gt{}]
1504   \index[dir]{RegexWhere}
1505   \index[dir]{Directive!RegexWhere}
1506   This directive applies only to a Restore job and specifies a regex filename
1507   manipulation of all files being restored.  This will use \ilink{File
1508   Relocation}{filerelocation} feature implemented in Bacula 2.1.8 or later.
1509
1510   For more informations about how use this option, see
1511   \ilink{this}{useregexwhere}.
1512
1513 \item [Replace = \lt{}replace-option\gt{}]
1514    \index[dir]{Replace}
1515    \index[dir]{Directive!Replace}
1516    This directive applies only to a Restore job and specifies what happens
1517    when Bacula wants to restore a file or directory that already exists.
1518    You have the following options for {\bf replace-option}:
1519
1520 \begin{description}
1521
1522 \item [always]
1523    \index[dir]{always}
1524   when the file to be restored already exists, it is deleted and then
1525   replaced by the copy that was backed up.  This is the default value.
1526
1527 \item [ifnewer]
1528 \index[dir]{ifnewer}
1529   if the backed up file (on tape) is newer than the existing file, the
1530   existing file is deleted and replaced by the back up.
1531
1532 \item [ifolder]
1533    \index[dir]{ifolder}
1534   if the backed up file (on tape) is older than the existing file, the
1535   existing file is deleted and replaced by the back up.
1536
1537 \item [never]
1538    \index[dir]{never}
1539   if the backed up file already exists, Bacula skips  restoring this file.  
1540 \end{description}
1541
1542 \item [Prefix Links=\lt{}yes|no\gt{}]
1543    \index[dir]{Prefix Links}
1544    \index[dir]{Directive!Prefix Links}
1545    If a {\bf Where} path prefix is specified for a recovery job, apply it
1546    to absolute links as well.  The default is {\bf No}.  When set to {\bf
1547    Yes} then while restoring files to an alternate directory, any absolute
1548    soft links will also be modified to point to the new alternate
1549    directory.  Normally this is what is desired -- i.e.  everything is self
1550    consistent.  However, if you wish to later move the files to their
1551    original locations, all files linked with absolute names will be broken.
1552
1553 \item [Maximum Concurrent Jobs = \lt{}number\gt{}]
1554    \index[dir]{Maximum Concurrent Jobs}
1555    \index[dir]{Directive!Maximum Concurrent Jobs}
1556    where \lt{}number\gt{} is the maximum number of Jobs from the current
1557    Job resource that can run concurrently.  Note, this directive limits
1558    only Jobs with the same name as the resource in which it appears.  Any
1559    other restrictions on the maximum concurrent jobs such as in the
1560    Director, Client, or Storage resources will also apply in addition to
1561    the limit specified here.  The default is set to 1, but you may set it
1562    to a larger number.  We strongly recommend that you read the WARNING
1563    documented under \ilink{ Maximum Concurrent Jobs}{DirMaxConJobs} in the
1564    Director's resource.
1565
1566 \item [Reschedule On Error = \lt{}yes|no\gt{}]
1567    \index[dir]{Reschedule On Error}
1568    \index[dir]{Directive!Reschedule On Error}
1569    If this directive is enabled, and the job terminates in error, the job
1570    will be rescheduled as determined by the {\bf Reschedule Interval} and
1571    {\bf Reschedule Times} directives.  If you cancel the job, it will not
1572    be rescheduled.  The default is {\bf no} (i.e.  the job will not be
1573    rescheduled).
1574
1575    This specification can be useful for portables, laptops, or other
1576    machines that are not always connected to the network or switched on.
1577
1578 \item [Reschedule Interval = \lt{}time-specification\gt{}]
1579    \index[dir]{Reschedule Interval}
1580    \index[dir]{Directive!Reschedule Interval}
1581    If you have specified {\bf Reschedule On Error = yes} and the job
1582    terminates in error, it will be rescheduled after the interval of time
1583    specified by {\bf time-specification}.  See \ilink{the time
1584    specification formats}{Time} in the Configure chapter for details of
1585    time specifications.  If no interval is specified, the job will not be
1586    rescheduled on error.
1587
1588 \item [Reschedule Times = \lt{}count\gt{}]
1589    \index[dir]{Reschedule Times}
1590    \index[dir]{Directive!Reschedule Times}
1591    This directive specifies the maximum number of times to reschedule the
1592    job.  If it is set to zero (the default) the job will be rescheduled an
1593    indefinite number of times.
1594
1595 \item [Run = \lt{}job-name\gt{}]
1596    \index[dir]{Run}
1597    \index[dir]{Directive!Run}
1598    \index[dir]{Clone a Job}
1599    The Run directive (not to be confused with the Run option in a 
1600    Schedule) allows you to start other jobs or to clone jobs. By using the
1601    cloning keywords (see below), you can backup
1602    the same data (or almost the same data) to two or more drives
1603    at the same time. The {\bf job-name} is normally the same name
1604    as the current Job resource (thus creating a clone). However, it
1605    may be any Job name, so one job may start other related jobs.
1606
1607    The part after the equal sign must be enclosed in double quotes,
1608    and can contain any string or set of options (overrides) that you
1609    can specify when entering the Run command from the console. For
1610    example {\bf storage=DDS-4 ...}.  In addition, there are two special
1611    keywords that permit you to clone the current job. They are {\bf level=\%l}
1612    and {\bf since=\%s}. The \%l in the level keyword permits 
1613    entering the actual level of the current job and the \%s in the since
1614    keyword permits putting the same time for comparison as used on the
1615    current job.  Note, in the case of the since keyword, the \%s must be
1616    enclosed in double quotes, and thus they must be preceded by a backslash
1617    since they are already inside quotes. For example:
1618
1619 \begin{verbatim}
1620    run = "Nightly-backup level=%l since=\"%s\" storage=DDS-4"
1621 \end{verbatim}
1622
1623    A cloned job will not start additional clones, so it is not
1624    possible to recurse.
1625
1626    Please note that all cloned jobs, as specified in the Run directives are
1627    submitted for running before the original job is run (while it is being
1628    initialized). This means that any clone job will actually start before
1629    the original job, and may even block the original job from starting
1630    until the original job finishes unless you allow multiple simultaneous
1631    jobs.  Even if you set a lower priority on the clone job, if no other
1632    jobs are running, it will start before the original job.
1633
1634    If you are trying to prioritize jobs by using the clone feature (Run
1635    directive), you will find it much easier to do using a RunScript
1636    resource, or a RunBeforeJob directive.
1637
1638 \label{Priority}
1639 \item [Priority = \lt{}number\gt{}]
1640    \index[dir]{Priority}
1641    \index[dir]{Directive!Priority}
1642    This directive permits you to control the order in which your jobs will
1643    be run by specifying a positive non-zero number. The higher the number,
1644    the lower the job priority. Assuming you are not running concurrent jobs,
1645    all queued jobs of priority 1 will run before queued jobs of priority 2
1646    and so on, regardless of the original scheduling order.
1647
1648    The priority only affects waiting jobs that are queued to run, not jobs
1649    that are already running.  If one or more jobs of priority 2 are already
1650    running, and a new job is scheduled with priority 1, the currently
1651    running priority 2 jobs must complete before the priority 1 job is run.
1652
1653    The default priority is 10.  
1654
1655    If you want to run concurrent jobs you should
1656    keep these points in mind:
1657
1658 \begin{itemize}
1659 \item See \ilink{Running Concurrent Jobs}{ConcurrentJobs} on how to setup
1660    concurrent jobs.
1661
1662 \item Bacula concurrently runs jobs of only one priority at a time.  It
1663    will not simultaneously run a priority 1 and a priority 2 job.
1664
1665 \item If Bacula is running a priority 2 job and a new priority 1 job is
1666    scheduled, it will wait until the running priority 2 job terminates even
1667    if the Maximum Concurrent Jobs settings would otherwise allow two jobs
1668    to run simultaneously.
1669
1670 \item Suppose that bacula is running a priority 2 job and a new priority 1
1671    job is scheduled and queued waiting for the running priority 2 job to
1672    terminate.  If you then start a second priority 2 job, the waiting
1673    priority 1 job will prevent the new priority 2 job from running
1674    concurrently with the running priority 2 job.  That is: as long as there
1675    is a higher priority job waiting to run, no new lower priority jobs will
1676    start even if the Maximum Concurrent Jobs settings would normally allow
1677    them to run.  This ensures that higher priority jobs will be run as soon
1678    as possible.
1679 \end{itemize}
1680
1681 If you have several jobs of different priority, it may not best to start
1682 them at exactly the same time, because Bacula must examine them one at a
1683 time.  If by Bacula starts a lower priority job first, then it will run
1684 before your high priority jobs.  If you experience this problem, you may
1685 avoid it by starting any higher priority jobs a few seconds before lower
1686 priority ones.  This insures that Bacula will examine the jobs in the
1687 correct order, and that your priority scheme will be respected.
1688
1689 \label{WritePartAfterJob}
1690 \item [Write Part After Job = \lt{}yes|no\gt{}]
1691 \index[dir]{Write Part After Job}
1692 \index[dir]{Directive!Write Part After Job}
1693    This directive is only implemented in version 1.37 and later.
1694    If this directive is set to {\bf yes} (default {\bf no}), a new part file
1695    will be created after the job is finished.  
1696
1697    It should be set to {\bf yes} when writing to devices that require mount
1698    (for example DVD), so you are sure that the current part, containing
1699    this job's data, is written to the device, and that no data is left in
1700    the temporary file on the hard disk.  However, on some media, like DVD+R
1701    and DVD-R, a lot of space (about 10Mb) is lost every time a part is
1702    written.  So, if you run several jobs each after another, you could set
1703    this directive to {\bf no} for all jobs, except the last one, to avoid
1704    wasting too much space, but to ensure that the data is written to the
1705    medium when all jobs are finished.
1706
1707    This directive is ignored with tape and FIFO devices.  
1708
1709 \item [Use Statistics = \lt{}yes|no\gt{}]
1710   \label{JobUseStatistics}
1711   \index{dir}{Use Statistics}
1712   \index{dir}{Directive!Statistics}
1713
1714   This directive is optional (default \textbf{no}) and if specified will cause
1715   the Director to keep job record in \texttt{JobStat} catalog table. This table
1716   can be used to make longterm statistics. This table will not be pruned by
1717   standard prunning algorithm. See \ilink{Prunning
1718     Statistics}{PruneStatistics} for more information.
1719
1720 \end{description}
1721
1722 The following is an example of a valid Job resource definition: 
1723
1724 \footnotesize
1725 \begin{verbatim}
1726 Job {
1727   Name = "Minou"
1728   Type = Backup
1729   Level = Incremental                 # default
1730   Client = Minou
1731   FileSet="Minou Full Set"
1732   Storage = DLTDrive
1733   Pool = Default
1734   Schedule = "MinouWeeklyCycle"
1735   Messages = Standard
1736 }
1737 \end{verbatim}
1738 \normalsize
1739
1740 \section{The JobDefs Resource}
1741 \label{JobDefsResource}
1742 \index[general]{JobDefs Resource}
1743 \index[general]{Resource!JobDefs}
1744
1745 The JobDefs resource permits all the same directives that can appear in a Job
1746 resource. However, a JobDefs resource does not create a Job, rather it can be
1747 referenced within a Job to provide defaults for that Job. This permits you to
1748 concisely define several nearly identical Jobs, each one referencing a JobDefs
1749 resource which contains the defaults. Only the changes from the defaults need to
1750 be mentioned in each Job. 
1751
1752 \section{The Schedule Resource}
1753 \label{ScheduleResource}
1754 \index[general]{Resource!Schedule}
1755 \index[general]{Schedule Resource}
1756
1757 The Schedule resource provides a means of automatically scheduling a Job as
1758 well as the ability to override the default Level, Pool, Storage and Messages
1759 resources. If a Schedule resource is not referenced in a Job, the Job can only
1760 be run manually. In general, you specify an action to be taken and when. 
1761
1762 \begin{description}
1763
1764 \item [Schedule]
1765 \index[dir]{Schedule}
1766 \index[dir]{Directive!Schedule}
1767    Start of the Schedule directives.  No {\bf Schedule} resource is
1768    required, but you will need at least one if you want Jobs to be
1769    automatically started.
1770
1771 \item [Name = \lt{}name\gt{}]
1772    \index[dir]{Name}
1773    \index[dir]{Directive!Name}
1774    The name of the schedule being defined.  The Name directive is required. 
1775
1776 \item [Run = \lt{}Job-overrides\gt{} \lt{}Date-time-specification\gt{}]
1777    \index[dir]{Run}
1778    \index[dir]{Directive!Run}
1779    The Run directive defines when a Job is to be run, and what overrides if
1780    any to apply.  You may specify multiple {\bf run} directives within a
1781    {\bf Schedule} resource.  If you do, they will all be applied (i.e.
1782    multiple schedules).  If you have two {\bf Run} directives that start at
1783    the same time, two Jobs will start at the same time (well, within one
1784    second of each other).
1785
1786    The {\bf Job-overrides} permit overriding the Level, the Storage, the
1787    Messages, and the Pool specifications provided in the Job resource.  In
1788    addition, the FullPool, the IncrementalPool, and the DifferentialPool
1789    specifications permit overriding the Pool specification according to
1790    what backup Job Level is in effect.
1791
1792    By the use of overrides, you may customize a particular Job.  For
1793    example, you may specify a Messages override for your Incremental
1794    backups that outputs messages to a log file, but for your weekly or
1795    monthly Full backups, you may send the output by email by using a
1796    different Messages override.
1797
1798    {\bf Job-overrides} are specified as: {\bf keyword=value} where the
1799    keyword is Level, Storage, Messages, Pool, FullPool, DifferentialPool,
1800    or IncrementalPool, and the {\bf value} is as defined on the respective
1801    directive formats for the Job resource.  You may specify multiple {\bf
1802    Job-overrides} on one {\bf Run} directive by separating them with one or
1803    more spaces or by separating them with a trailing comma.  For example:
1804
1805 \begin{description}
1806
1807 \item [Level=Full]
1808    \index[dir]{Level}
1809    \index[dir]{Directive!Level}
1810    is all files in the FileSet whether or not  they have changed.  
1811
1812 \item [Level=Incremental]
1813    \index[dir]{Level}
1814    \index[dir]{Directive!Level}
1815    is all files that have changed since  the last backup.  
1816
1817 \item [Pool=Weekly]
1818    \index[dir]{Pool}
1819    \index[dir]{Directive!Pool}
1820    specifies to use the Pool named {\bf Weekly}.  
1821
1822 \item [Storage=DLT\_Drive]
1823    \index[dir]{Storage}
1824    \index[dir]{Directive!Storage}
1825    specifies to use {\bf DLT\_Drive} for  the storage device.  
1826
1827 \item [Messages=Verbose]
1828    \index[dir]{Messages}
1829    \index[dir]{Directive!Messages}
1830    specifies to use the {\bf Verbose}  message resource for the Job.  
1831
1832 \item [FullPool=Full]
1833    \index[dir]{FullPool}
1834    \index[dir]{Directive!FullPool}
1835    specifies to use the Pool named {\bf Full}  if the job is a full backup, or
1836 is
1837 upgraded from another type  to a full backup.  
1838
1839 \item [DifferentialPool=Differential]
1840    \index[dir]{DifferentialPool}
1841    \index[dir]{Directive!DifferentialPool}
1842    specifies to use the Pool named {\bf Differential} if the job is a
1843    differential  backup.  
1844
1845 \item [IncrementalPool=Incremental]
1846    \index[dir]{IncrementalPool}
1847    \index[dir]{Directive!IncrementalPool}
1848    specifies to use the Pool  named {\bf Incremental} if the job is an
1849 incremental  backup.  
1850
1851 \item [SpoolData=yes|no]
1852    \index[dir]{SpoolData}
1853    \index[dir]{Directive!SpoolData}
1854    tells Bacula to request the Storage  daemon to spool data to a disk file
1855    before writing it to the Volume (normally a tape). Thus the data is
1856    written in large blocks to the Volume rather than small blocks. This
1857    directive is particularly useful when running multiple simultaneous
1858    backups to tape. It prevents interleaving of the job data and reduces
1859    or eliminates tape drive stop and start commonly known as "shoe-shine".
1860
1861 \item [SpoolSize={\it bytes}]
1862    \index[dir]{SpoolSize}
1863    \index[dir]{Directive!SpoolSize}
1864    where the bytes specify the maximum spool size for this job.
1865    The default is take from Device Maximum Spool Size limit. 
1866    This directive is available only in Bacula version 2.3.5 or 
1867    later.
1868
1869 \item [WritePartAfterJob=yes|no]
1870    \index[dir]{WritePartAfterJob}
1871    \index[dir]{Directive!WritePartAfterJob}
1872    tells Bacula to request the Storage daemon to write the current part
1873    file to the device when the job is finished (see \ilink{Write Part After
1874    Job directive in the Job resource}{WritePartAfterJob}).  Please note,
1875    this directive is implemented only in version 1.37 and later.  The
1876    default is yes.  We strongly recommend that you keep this set to yes
1877    otherwise, when the last job has finished one part will remain in the
1878    spool file and restore may or may not work.
1879
1880 \end{description}
1881
1882 {\bf Date-time-specification} determines when the  Job is to be run. The
1883 specification is a repetition, and as  a default Bacula is set to run a job at
1884 the beginning of the  hour of every hour of every day of every week of every
1885 month  of every year. This is not normally what you want, so you  must specify
1886 or limit when you want the job to run. Any  specification given is assumed to
1887 be repetitive in nature and  will serve to override or limit the default
1888 repetition. This  is done by specifying masks or times for the hour, day of the
1889 month, day of the week, week of the month, week of the year,  and month when
1890 you want the job to run. By specifying one or  more of the above, you can
1891 define a schedule to repeat at  almost any frequency you want.  
1892
1893 Basically, you must supply a {\bf month}, {\bf day}, {\bf hour}, and  {\bf
1894 minute} the Job is to be run. Of these four items to be specified,  {\bf day}
1895 is special in that you may either specify a day of the month  such as 1, 2,
1896 ... 31, or you may specify a day of the week such  as Monday, Tuesday, ...
1897 Sunday. Finally, you may also specify a  week qualifier to restrict the
1898 schedule to the first, second, third,  fourth, or fifth week of the month.  
1899
1900 For example, if you specify only a day of the week, such as {\bf Tuesday}  the
1901 Job will be run every hour of every Tuesday of every Month. That  is the {\bf
1902 month} and {\bf hour} remain set to the defaults of  every month and all
1903 hours.  
1904
1905 Note, by default with no other specification, your job will run  at the
1906 beginning of every hour. If you wish your job to run more than  once in any
1907 given hour, you will need to specify multiple {\bf run}  specifications each
1908 with a different minute.  
1909
1910 The date/time to run the Job can be specified in the following way  in
1911 pseudo-BNF:  
1912
1913 \footnotesize
1914 \begin{verbatim}
1915 <void-keyword>    = on
1916 <at-keyword>      = at
1917 <week-keyword>    = 1st | 2nd | 3rd | 4th | 5th | first |
1918                     second | third | fourth | fifth
1919 <wday-keyword>    = sun | mon | tue | wed | thu | fri | sat |
1920                     sunday | monday | tuesday | wednesday |
1921                     thursday | friday | saturday
1922 <week-of-year-keyword> = w00 | w01 | ... w52 | w53
1923 <month-keyword>   = jan | feb | mar | apr | may | jun | jul |
1924                     aug | sep | oct | nov | dec | january |
1925                     february | ... | december
1926 <daily-keyword>   = daily
1927 <weekly-keyword>  = weekly
1928 <monthly-keyword> = monthly
1929 <hourly-keyword>  = hourly
1930 <digit>           = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0
1931 <number>          = <digit> | <digit><number>
1932 <12hour>          = 0 | 1 | 2 | ... 12
1933 <hour>            = 0 | 1 | 2 | ... 23
1934 <minute>          = 0 | 1 | 2 | ... 59
1935 <day>             = 1 | 2 | ... 31
1936 <time>            = <hour>:<minute> |
1937                     <12hour>:<minute>am |
1938                     <12hour>:<minute>pm
1939 <time-spec>       = <at-keyword> <time> |
1940                     <hourly-keyword>
1941 <date-keyword>    = <void-keyword>  <weekly-keyword>
1942 <day-range>       = <day>-<day>
1943 <month-range>     = <month-keyword>-<month-keyword>
1944 <wday-range>      = <wday-keyword>-<wday-keyword>
1945 <range>           = <day-range> | <month-range> |
1946                           <wday-range>
1947 <date>            = <date-keyword> | <day> | <range>
1948 <date-spec>       = <date> | <date-spec>
1949 <day-spec>        = <day> | <wday-keyword> |
1950                     <day-range> | <wday-range> |
1951                     <daily-keyword>
1952 <day-spec>        = <day> | <wday-keyword> |
1953                     <day> | <wday-range> |
1954                     <week-keyword> <wday-keyword> |
1955                     <week-keyword> <wday-range>
1956 <month-spec>      = <month-keyword> | <month-range> |
1957                     <monthly-keyword>
1958 <date-time-spec>  = <month-spec> <day-spec> <time-spec>
1959 \end{verbatim}
1960 \normalsize
1961
1962 \end{description}
1963
1964 Note, the Week of Year specification wnn follows the ISO standard definition
1965 of the week of the year, where Week 1 is the week in which the first Thursday
1966 of the year occurs, or alternatively, the week which contains the 4th of
1967 January. Weeks are numbered w01 to w53. w00 for Bacula is the week that
1968 precedes the first ISO week (i.e. has the first few days of the year if any
1969 occur before Thursday). w00 is not defined by the ISO specification. A week
1970 starts with Monday and ends with Sunday. 
1971
1972 According to the NIST (US National Institute of Standards and Technology),
1973 12am and 12pm are ambiguous and can be defined to anything.  However,
1974 12:01am is the same as 00:01 and 12:01pm is the same as 12:01, so Bacula
1975 defines 12am as 00:00 (midnight) and 12pm as 12:00 (noon).  You can avoid
1976 this abiguity (confusion) by using 24 hour time specifications (i.e.  no
1977 am/pm). This is the definition in Bacula version 2.0.3 and later.
1978
1979 An example schedule resource that is named {\bf WeeklyCycle} and runs a job
1980 with level full each Sunday at 2:05am and an incremental job Monday through
1981 Saturday at 2:05am is: 
1982
1983 \footnotesize
1984 \begin{verbatim}
1985 Schedule {
1986   Name = "WeeklyCycle"
1987   Run = Level=Full sun at 2:05
1988   Run = Level=Incremental mon-sat at 2:05
1989 }
1990 \end{verbatim}
1991 \normalsize
1992
1993 An example of a possible monthly cycle is as follows: 
1994
1995 \footnotesize
1996 \begin{verbatim}
1997 Schedule {
1998   Name = "MonthlyCycle"
1999   Run = Level=Full Pool=Monthly 1st sun at 2:05
2000   Run = Level=Differential 2nd-5th sun at 2:05
2001   Run = Level=Incremental Pool=Daily mon-sat at 2:05
2002 }
2003 \end{verbatim}
2004 \normalsize
2005
2006 The first of every month: 
2007
2008 \footnotesize
2009 \begin{verbatim}
2010 Schedule {
2011   Name = "First"
2012   Run = Level=Full on 1 at 2:05
2013   Run = Level=Incremental on 2-31 at 2:05
2014 }
2015 \end{verbatim}
2016 \normalsize
2017
2018 Every 10 minutes: 
2019
2020 \footnotesize
2021 \begin{verbatim}
2022 Schedule {
2023   Name = "TenMinutes"
2024   Run = Level=Full hourly at 0:05
2025   Run = Level=Full hourly at 0:15
2026   Run = Level=Full hourly at 0:25
2027   Run = Level=Full hourly at 0:35
2028   Run = Level=Full hourly at 0:45
2029   Run = Level=Full hourly at 0:55
2030 }
2031 \end{verbatim}
2032 \normalsize
2033
2034 \section{Technical Notes on Schedules}
2035 \index[general]{Schedules!Technical Notes on}
2036 \index[general]{Technical Notes on Schedules}
2037
2038 Internally Bacula keeps a schedule as a bit mask. There are six masks and a
2039 minute field to each schedule. The masks are hour, day of the month (mday),
2040 month, day of the week (wday), week of the month (wom), and week of the year
2041 (woy). The schedule is initialized to have the bits of each of these masks
2042 set, which means that at the beginning of every hour, the job will run. When
2043 you specify a month for the first time, the mask will be cleared and the bit
2044 corresponding to your selected month will be selected. If you specify a second
2045 month, the bit corresponding to it will also be added to the mask. Thus when
2046 Bacula checks the masks to see if the bits are set corresponding to the
2047 current time, your job will run only in the two months you have set. Likewise,
2048 if you set a time (hour), the hour mask will be cleared, and the hour you
2049 specify will be set in the bit mask and the minutes will be stored in the
2050 minute field. 
2051
2052 For any schedule you have defined, you can see how these bits are set by doing
2053 a {\bf show schedules} command in the Console program. Please note that the
2054 bit mask is zero based, and Sunday is the first day of the week (bit zero). 
2055
2056 \input{fileset}
2057
2058 \section{The Client Resource}
2059 \label{ClientResource2}
2060 \index[general]{Resource!Client}
2061 \index[general]{Client Resource}
2062
2063 The Client resource defines the attributes of the Clients that are served by
2064 this Director; that is the machines that are to be backed up. You will need
2065 one Client resource definition for each machine to be backed up. 
2066
2067 \begin{description}
2068
2069 \item [Client (or FileDaemon)]
2070    \index[dir]{Client (or FileDaemon)}
2071    \index[dir]{Directive!Client (or FileDaemon)}
2072    Start of the Client directives.  
2073
2074 \item [Name = \lt{}name\gt{}]
2075    \index[dir]{Name}
2076    \index[dir]{Directive!Name}
2077    The client name which will be used in the  Job resource directive or in the
2078 console run command.  This directive is required.  
2079
2080 \item [Address = \lt{}address\gt{}]
2081    \index[dir]{Address}
2082    \index[dir]{Directive!FD Address}
2083    \index[dir]{File Daemon Address}
2084    \index[dir]{Client Address}
2085    Where the address is a host name, a fully qualified domain name, or a
2086    network address in dotted quad notation for a Bacula File server daemon.
2087    This directive is required.
2088
2089 \item [FD Port = \lt{}port-number\gt{}]
2090    \index[dir]{FD Port}
2091    \index[dir]{Directive!FD Port}
2092    Where the port is a port  number at which the Bacula File server daemon can
2093    be contacted.  The default is 9102. 
2094
2095 \item [Catalog = \lt{}Catalog-resource-name\gt{}]
2096    \index[dir]{Catalog}
2097    \index[dir]{Directive!Catalog}
2098    This specifies the  name of the catalog resource to be used for this Client. 
2099    This directive is required.  
2100
2101 \item [Password = \lt{}password\gt{}]
2102    \index[dir]{Password}
2103    \index[dir]{Directive!Password}
2104    This is the password to be  used when establishing a connection with the File
2105    services, so  the Client configuration file on the machine to be backed up
2106    must  have the same password defined for this Director. This directive is 
2107    required.  If you have either {\bf /dev/random}  {\bf bc} on your machine,
2108    Bacula will generate a random  password during the configuration process,
2109    otherwise it will  be left blank. 
2110
2111    The password is plain text.  It is not generated through any special
2112    process, but it is preferable for security reasons to make the text
2113    random.
2114
2115 \label{FileRetention}
2116 \item [File Retention = \lt{}time-period-specification\gt{}]
2117    \index[dir]{File Retention}
2118    \index[dir]{Directive!File Retention}
2119    The File Retention directive defines the length of time that  Bacula will
2120    keep File records in the Catalog database after the End time of the
2121    Job corresponding to the File records.
2122    When this time period expires, and if
2123    {\bf AutoPrune} is set to  {\bf yes} Bacula will prune (remove) File records
2124    that  are older than the specified File Retention period. Note, this  affects
2125    only records in the catalog database. It does not  affect your archive
2126    backups.  
2127
2128    File records  may actually be retained for a shorter period than you specify
2129    on  this directive if you specify either a shorter {\bf Job Retention}  or a
2130    shorter {\bf Volume Retention} period. The shortest  retention period of the
2131    three takes precedence.  The time may be expressed in seconds, minutes, 
2132    hours, days, weeks, months, quarters, or years. See the 
2133    \ilink{ Configuration chapter}{Time} of this  manual for
2134    additional details of time specification. 
2135
2136    The  default is 60 days. 
2137
2138 \label{JobRetention}
2139 \item [Job Retention = \lt{}time-period-specification\gt{}]
2140    \index[dir]{Job Retention}
2141    \index[dir]{Directive!Job Retention}
2142    The Job Retention directive defines the length of time that  Bacula will keep
2143    Job records in the Catalog database after the Job End time.  When
2144    this time period expires, and if {\bf AutoPrune} is set to {\bf yes}
2145    Bacula will prune (remove) Job records that are older than the specified
2146    File Retention period.  As with the other retention periods, this
2147    affects only records in the catalog and not data in your archive backup.
2148
2149    If a Job record is selected for pruning, all associated File and JobMedia
2150    records will also be pruned regardless of the File Retention period set.
2151    As a consequence, you normally will set the File retention period to be
2152    less than the Job retention period.  The Job retention period can actually
2153    be less than the value you specify here if you set the {\bf Volume
2154    Retention} directive in the Pool resource to a smaller duration.  This is
2155    because the Job retention period and the Volume retention period are
2156    independently applied, so the smaller of the two takes precedence.
2157
2158    The Job retention period is specified as seconds,  minutes, hours, days,
2159    weeks, months,  quarters, or years.  See the 
2160    \ilink{ Configuration chapter}{Time} of this manual for
2161    additional details of  time specification.  
2162
2163    The default is 180 days.  
2164
2165 \label{AutoPrune}
2166 \item [AutoPrune = \lt{}yes|no\gt{}]
2167    \index[dir]{AutoPrune}
2168    \index[dir]{Directive!AutoPrune}
2169    If AutoPrune is set to  {\bf yes} (default), Bacula (version 1.20 or greater)
2170    will  automatically apply the File retention period and the Job  retention
2171    period for the Client at the end of the Job.  If you set {\bf AutoPrune = no},
2172    pruning will not be done,  and your Catalog will grow in size each time you
2173    run a Job.  Pruning affects only information in the catalog and not data 
2174    stored in the backup archives (on Volumes).  
2175
2176 \item [Maximum Concurrent Jobs = \lt{}number\gt{}]
2177    \index[dir]{Maximum Concurrent Jobs}
2178    \index[dir]{Directive!Maximum Concurrent Jobs}
2179    where \lt{}number\gt{}  is the maximum number of Jobs with the current Client
2180    that  can run concurrently. Note, this directive limits only Jobs  for Clients
2181    with the same name as the resource in which it appears. Any  other
2182    restrictions on the maximum concurrent jobs such as in  the Director, Job, or
2183    Storage resources will also apply in addition to  any limit specified here.
2184    The  default is set to 1, but you may set it to a larger number.  We strongly
2185    recommend that you read the WARNING documented under  
2186    \ilink{ Maximum Concurrent Jobs}{DirMaxConJobs} in the Director's
2187    resource.  
2188
2189 \item [Priority = \lt{}number\gt{}]
2190    \index[dir]{Priority}
2191    \index[dir]{Directive!Priority}
2192    The number specifies the  priority of this client relative to other clients
2193    that the  Director is processing simultaneously. The priority can range  from
2194    1 to 1000. The clients are ordered such that the smaller  number priorities
2195    are performed first (not currently  implemented). 
2196 \end{description}
2197
2198    The following is an example of a valid Client resource definition: 
2199
2200 \footnotesize
2201 \begin{verbatim}
2202 Client {
2203   Name = Minimatou
2204   FDAddress = minimatou
2205   Catalog = MySQL
2206   Password = very_good
2207 }
2208 \end{verbatim}
2209 \normalsize
2210
2211 \section{The Storage Resource}
2212 \label{StorageResource2}
2213 \index[general]{Resource!Storage}
2214 \index[general]{Storage Resource}
2215
2216 The Storage resource defines which Storage daemons are available for use by
2217 the Director. 
2218
2219 \begin{description}
2220
2221 \item [Storage]
2222    \index[dir]{Storage}
2223    \index[dir]{Directive!Storage}
2224    Start of the Storage resources. At least one  storage resource must be
2225    specified. 
2226
2227 \item [Name = \lt{}name\gt{}]
2228    \index[dir]{Name}
2229    \index[dir]{Directive!Name}
2230    The name of the storage resource. This  name appears on the Storage directive
2231    specified in the Job resource and is required. 
2232
2233 \item [Address = \lt{}address\gt{}]
2234    \index[dir]{Address}
2235    \index[dir]{Directive!SD Address}
2236    \index[dir]{Storage daemon Address}
2237    Where the address is a host name,  a {\bf fully qualified domain name}, or an
2238    {\bf IP address}. Please note  that the \lt{}address\gt{} as specified here
2239    will be transmitted to  the File daemon who will then use it to contact the
2240    Storage daemon. Hence,  it is {\bf not}, a good idea to use {\bf localhost} as
2241    the  name but rather a fully qualified machine name or an IP address.  This
2242    directive is required. 
2243
2244 \item [SD Port = \lt{}port\gt{}]
2245    \index[dir]{SD Port}
2246    \index[dir]{Directive!SD Port}
2247    Where port is the port to use to  contact the storage daemon for information
2248    and to start jobs.  This same port number must appear in the Storage resource
2249    of the  Storage daemon's configuration file. The default is 9103. 
2250
2251 \item [Password = \lt{}password\gt{}]
2252    \index[dir]{Password}
2253    \index[dir]{Directive!Password}
2254    This is the password to be used  when establishing a connection with the
2255    Storage services. This  same password also must appear in the Director
2256    resource of the Storage  daemon's configuration file. This directive is
2257    required.  If you have either {\bf /dev/random}  {\bf bc} on your machine,
2258    Bacula will generate a random  password during the configuration process,
2259    otherwise it will  be left blank. 
2260
2261    The password is plain text.  It is not generated through any special
2262    process, but it is preferable for security reasons to use random text.
2263
2264 \item [Device = \lt{}device-name\gt{}]
2265    \index[dir]{Device}
2266    \index[dir]{Directive!Device}
2267    This directive specifies the Storage daemon's name of the device
2268    resource to be used for the storage.  If you are using an Autochanger,
2269    the name specified here should be the name of the Storage daemon's
2270    Autochanger resource rather than the name of an individual device.  This
2271    name is not the physical device name, but the logical device name as
2272    defined on the {\bf Name} directive contained in the {\bf Device} or the
2273    {\bf Autochanger} resource definition of the {\bf Storage daemon}
2274    configuration file.  You can specify any name you would like (even the
2275    device name if you prefer) up to a maximum of 127 characters in length.
2276    The physical device name associated with this device is specified in the
2277    {\bf Storage daemon} configuration file (as {\bf Archive Device}).
2278    Please take care not to define two different Storage resource directives
2279    in the Director that point to the same Device in the Storage daemon.
2280    Doing so may cause the Storage daemon to block (or hang) attempting to
2281    open the same device that is already open.  This directive is required.
2282
2283 \label{MediaType}
2284 \item [Media Type = \lt{}MediaType\gt{}]
2285    \index[dir]{Media Type}
2286    \index[dir]{Directive!Media Type}
2287    This directive specifies the Media Type to be used to store the data.
2288    This is an arbitrary string of characters up to 127 maximum that you
2289    define.  It can be anything you want.  However, it is best to make it
2290    descriptive of the storage media (e.g.  File, DAT, "HP DLT8000", 8mm,
2291    ...).  In addition, it is essential that you make the {\bf Media Type}
2292    specification unique for each storage media type.  If you have two DDS-4
2293    drives that have incompatible formats, or if you have a DDS-4 drive and
2294    a DDS-4 autochanger, you almost certainly should specify different {\bf
2295    Media Types}.  During a restore, assuming a {\bf DDS-4} Media Type is
2296    associated with the Job, Bacula can decide to use any Storage daemon
2297    that supports Media Type {\bf DDS-4} and on any drive that supports it.
2298
2299    If you are writing to disk Volumes, you must make doubly sure that each
2300    Device resource defined in the Storage daemon (and hence in the
2301    Director's conf file) has a unique media type.  Otherwise for Bacula
2302    versions 1.38 and older, your restores may not work because Bacula
2303    will assume that you can mount any Media Type with the same name on
2304    any Device associated with that Media Type. This is possible with
2305    tape drives, but with disk drives, unless you are very clever you
2306    cannot mount a Volume in any directory -- this can be done by creating
2307    an appropriate soft link.
2308
2309    Currently Bacula permits only a single Media Type per Storage           
2310    and Device definition. Consequently, if
2311    you have a drive that supports more than one Media Type, you can
2312    give a unique string to Volumes with different intrinsic Media 
2313    Type (Media Type = DDS-3-4 for DDS-3 and DDS-4 types), but then
2314    those volumes will only be mounted on drives indicated with the
2315    dual type (DDS-3-4).
2316
2317    If you want to tie Bacula to using a single Storage daemon or drive, you
2318    must specify a unique Media Type for that drive.  This is an important
2319    point that should be carefully understood.  Note, this applies equally
2320    to Disk Volumes.  If you define more than one disk Device resource in
2321    your Storage daemon's conf file, the Volumes on those two devices are in
2322    fact incompatible because one can not be mounted on the other device
2323    since they are found in different directories.  For this reason, you
2324    probably should use two different Media Types for your two disk Devices
2325    (even though you might think of them as both being File types).  You can
2326    find more on this subject in the \ilink{Basic Volume
2327    Management}{DiskChapter} chapter of this manual.
2328
2329    The {\bf MediaType} specified in the Director's Storage resource, {\bf
2330    must} correspond to the {\bf Media Type} specified in the {\bf Device}
2331    resource of the {\bf Storage daemon} configuration file.  This directive
2332    is required, and it is used by the Director and the Storage daemon to
2333    ensure that a Volume automatically selected from the Pool corresponds to
2334    the physical device.  If a Storage daemon handles multiple devices (e.g.
2335    will write to various file Volumes on different partitions), this
2336    directive allows you to specify exactly which device.
2337
2338    As mentioned above, the value specified in the Director's Storage
2339    resource must agree with the value specified in the Device resource in
2340    the {\bf Storage daemon's} configuration file.  It is also an additional
2341    check so that you don't try to write data for a DLT onto an 8mm device.
2342
2343 \label{Autochanger1}
2344 \item [Autochanger = \lt{}yes|no\gt{}]  
2345    \index[dir]{Autochanger}
2346    \index[dir]{Directive!Autochanger}
2347    If you specify {\bf yes} for this command (the default is {\bf no}),
2348    when you use the {\bf label} command or the {\bf add} command to create
2349    a new Volume, {\bf Bacula} will also request the Autochanger Slot
2350    number.  This simplifies creating database entries for Volumes in an
2351    autochanger.  If you forget to specify the Slot, the autochanger will
2352    not be used.  However, you may modify the Slot associated with a Volume
2353    at any time by using the {\bf update volume} or {\bf update slots}
2354    command in the console program.  When {\bf autochanger} is enabled, the
2355    algorithm used by Bacula to search for available volumes will be
2356    modified to consider only Volumes that are known to be in the
2357    autochanger's magazine.  If no {\bf in changer} volume is found, Bacula
2358    will attempt recycling, pruning, ..., and if still no volume is found,
2359    Bacula will search for any volume whether or not in the magazine.  By
2360    privileging in changer volumes, this procedure minimizes operator
2361    intervention.  The default is {\bf no}.
2362
2363    For the autochanger to be used, you must also specify {\bf Autochanger =
2364    yes} in the \ilink{Device Resource}{Autochanger} in the Storage daemon's
2365    configuration file as well as other important Storage daemon
2366    configuration information.  Please consult the \ilink{Using
2367    Autochangers}{AutochangersChapter} manual of this chapter for the
2368    details of using autochangers.
2369
2370 \item [Maximum Concurrent Jobs = \lt{}number\gt{}]
2371    \index[dir]{Maximum Concurrent Jobs}
2372    \index[dir]{Directive!Maximum Concurrent Jobs}
2373    where \lt{}number\gt{}  is the maximum number of Jobs with the current
2374    Storage resource that can run concurrently.  Note, this directive limits
2375    only Jobs for Jobs using this Storage daemon.  Any other restrictions on
2376    the maximum concurrent jobs such as in the Director, Job, or Client
2377    resources will also apply in addition to any limit specified here.  The
2378    default is set to 1, but you may set it to a larger number.  However, if
2379    you set the Storage daemon's number of concurrent jobs greater than one,
2380    we recommend that you read the waring documented under \ilink{Maximum
2381    Concurrent Jobs}{DirMaxConJobs} in the Director's resource or simply
2382    turn data spooling on as documented in the \ilink{Data
2383    Spooling}{SpoolingChapter} chapter of this manual.
2384
2385 \item [Heartbeat Interval = \lt{}time-interval\gt{}]
2386    \index[dir]{Heartbeat Interval}
2387    \index[dir]{Directive!Heartbeat}
2388    This directive is optional and if specified will cause the Director to
2389    set a keepalive interval (heartbeat) in seconds on each of the sockets
2390    it opens for the Storage resource.  This value will override any
2391    specified at the Director level.  It is implemented only on systems
2392    (Linux, ...) that provide the {\bf setsockopt} TCP\_KEEPIDLE function.
2393    The default value is zero, which means no change is made to the socket.
2394
2395 \end{description}
2396
2397 The following is an example of a valid Storage resource definition: 
2398
2399 \footnotesize
2400 \begin{verbatim}
2401 # Definition of tape storage device
2402 Storage {
2403   Name = DLTDrive
2404   Address = lpmatou
2405   Password = storage_password # password for Storage daemon
2406   Device = "HP DLT 80"    # same as Device in Storage daemon
2407   Media Type = DLT8000    # same as MediaType in Storage daemon
2408 }
2409 \end{verbatim}
2410 \normalsize
2411
2412 \section{The Pool Resource}
2413 \label{PoolResource}
2414 \index[general]{Resource!Pool}
2415 \index[general]{Pool Resource}
2416
2417 The Pool resource defines the set of storage Volumes (tapes or files) to be
2418 used by Bacula to write the data. By configuring different Pools, you can
2419 determine which set of Volumes (media) receives the backup data. This permits,
2420 for example, to store all full backup data on one set of Volumes and all
2421 incremental backups on another set of Volumes. Alternatively, you could assign
2422 a different set of Volumes to each machine that you backup. This is most
2423 easily done by defining multiple Pools. 
2424
2425 Another important aspect of a Pool is that it contains the default attributes
2426 (Maximum Jobs, Retention Period, Recycle flag, ...) that will be given to a
2427 Volume when it is created. This avoids the need for you to answer a large
2428 number of questions when labeling a new Volume. Each of these attributes can
2429 later be changed on a Volume by Volume basis using the {\bf update} command in
2430 the console program. Note that you must explicitly specify which Pool Bacula
2431 is to use with each Job. Bacula will not automatically search for the correct
2432 Pool. 
2433
2434 Most often in Bacula installations all backups for all machines (Clients) go
2435 to a single set of Volumes. In this case, you will probably only use the {\bf
2436 Default} Pool. If your backup strategy calls for you to mount a different tape
2437 each day, you will probably want to define a separate Pool for each day. For
2438 more information on this subject, please see the 
2439 \ilink{Backup Strategies}{StrategiesChapter} chapter of this
2440 manual. 
2441
2442
2443 To use a Pool, there are three distinct steps. First the Pool must be defined
2444 in the Director's configuration file. Then the Pool must be written to the
2445 Catalog database. This is done automatically by the Director each time that it
2446 starts, or alternatively can be done using the {\bf create} command in the
2447 console program. Finally, if you change the Pool definition in the Director's
2448 configuration file and restart Bacula, the pool will be updated alternatively
2449 you can use the {\bf update pool} console command to refresh the database
2450 image. It is this database image rather than the Director's resource image
2451 that is used for the default Volume attributes. Note, for the pool to be
2452 automatically created or updated, it must be explicitly referenced by a Job
2453 resource. 
2454
2455 Next the physical media must be labeled. The labeling can either be done with
2456 the {\bf label} command in the {\bf console} program or using the {\bf btape}
2457 program. The preferred method is to use the {\bf label} command in the {\bf
2458 console} program. 
2459
2460 Finally, you must add Volume names (and their attributes) to the Pool. For
2461 Volumes to be used by Bacula they must be of the same {\bf Media Type} as the
2462 archive device specified for the job (i.e. if you are going to back up to a
2463 DLT device, the Pool must have DLT volumes defined since 8mm volumes cannot be
2464 mounted on a DLT drive). The {\bf Media Type} has particular importance if you
2465 are backing up to files. When running a Job, you must explicitly specify which
2466 Pool to use. Bacula will then automatically select the next Volume to use from
2467 the Pool, but it will ensure that the {\bf Media Type} of any Volume selected
2468 from the Pool is identical to that required by the Storage resource you have
2469 specified for the Job. 
2470
2471 If you use the {\bf label} command in the console program to label the
2472 Volumes, they will automatically be added to the Pool, so this last step is
2473 not normally required. 
2474
2475 It is also possible to add Volumes to the database without explicitly labeling
2476 the physical volume. This is done with the {\bf add} console command. 
2477
2478 As previously mentioned, each time Bacula starts, it scans all the Pools
2479 associated with each Catalog, and if the database record does not already
2480 exist, it will be created from the Pool Resource definition. {\bf Bacula}
2481 probably should do an {\bf update pool} if you change the Pool definition, but
2482 currently, you must do this manually using the {\bf update pool} command in
2483 the Console program. 
2484
2485 The Pool Resource defined in the Director's configuration file
2486 (bacula-dir.conf) may contain the following directives: 
2487
2488 \begin{description}
2489
2490 \item [Pool]
2491    \index[dir]{Pool}
2492    \index[dir]{Directive!Pool}
2493    Start of the Pool resource.  There must be at least one Pool resource
2494    defined.
2495
2496
2497 \item [Name = \lt{}name\gt{}]
2498    \index[dir]{Name}
2499    \index[dir]{Directive!Name}
2500    The name of the pool.  For most applications, you will use the default
2501    pool name {\bf Default}.  This directive is required.
2502
2503 \label{MaxVolumes}
2504 \item [Maximum Volumes = \lt{}number\gt{}]
2505    \index[dir]{Maximum Volumes}
2506    \index[dir]{Directive!Maximum Volumes}
2507    This directive specifies the maximum number of volumes (tapes or files)
2508    contained in the pool.  This directive is optional, if omitted or set to
2509    zero, any number of volumes will be permitted.  In general, this
2510    directive is useful for Autochangers where there is a fixed number of
2511    Volumes, or for File storage where you wish to ensure that the backups
2512    made to disk files do not become too numerous or consume too much space.
2513
2514 \item [Pool Type = \lt{}type\gt{}]
2515    \index[dir]{Pool Type}
2516    \index[dir]{Directive!Pool Type}
2517    This directive defines the pool type, which corresponds to the type of
2518    Job being run.  It is required and may be one of the following:
2519
2520 \begin{itemize}
2521   \item [Backup]  
2522   \item [*Archive]  
2523   \item [*Cloned]  
2524   \item [*Migration]  
2525   \item [*Copy]  
2526   \item [*Save]  
2527 \end{itemize}
2528    Note, only Backup is current implemented.
2529
2530 \item [Storage = \lt{}storage-resource-name\gt{}]
2531 \index[dir]{Storage}
2532 \index[dir]{Directive!Storage}
2533    The Storage directive defines the name of the storage services where you
2534    want to backup the FileSet data.  For additional details, see the
2535    \ilink{Storage Resource Chapter}{StorageResource2} of this manual.
2536    The Storage resource may also be specified in the Job resource,
2537    but the value, if any, in the Pool resource overrides any value
2538    in the Job. This Storage resource definition is not required by either
2539    the Job resource or in the Pool, but it must be specified in
2540    one or the other.  If not configuration error will result.
2541
2542 \item [Use Volume Once = \lt{}yes|no\gt{}]
2543    \index[dir]{Use Volume Once}
2544    \index[dir]{Directive!Use Volume Once}
2545    This directive if set to {\bf yes} specifies that each volume is to be
2546    used only once.  This is most useful when the Media is a file and you
2547    want a new file for each backup that is done.  The default is {\bf no}
2548    (i.e.  use volume any number of times).  This directive will most likely
2549    be phased out (deprecated), so you are recommended to use {\bf Maximum
2550    Volume Jobs = 1} instead.
2551
2552    The value defined by this directive in the bacula-dir.conf file is the
2553    default value used when a Volume is created.  Once the volume is
2554    created, changing the value in the bacula-dir.conf file will not change
2555    what is stored for the Volume.  To change the value for an existing
2556    Volume you must use the {\bf update} command in the Console.
2557
2558    Please see the notes below under {\bf Maximum Volume Jobs} concerning
2559    using this directive with multiple simultaneous jobs.
2560
2561 \item [Maximum Volume Jobs = \lt{}positive-integer\gt{}]
2562    \index[dir]{Maximum Volume Jobs}
2563    \index[dir]{Directive!Maximum Volume Jobs}
2564    This directive specifies the maximum number of Jobs that can be written
2565    to the Volume.  If you specify zero (the default), there is no limit.
2566    Otherwise, when the number of Jobs backed up to the Volume equals {\bf
2567    positive-integer} the Volume will be marked {\bf Used}.  When the Volume
2568    is marked {\bf Used} it can no longer be used for appending Jobs, much
2569    like the {\bf Full} status but it can be recycled if recycling is
2570    enabled, and thus used again.  By setting {\bf MaximumVolumeJobs} to
2571    one, you get the same effect as setting {\bf UseVolumeOnce = yes}.
2572
2573    The value defined by this directive in the  bacula-dir.conf
2574    file is the default value used when a Volume  is created. Once the volume is
2575    created, changing the value  in the bacula-dir.conf file will not change what
2576    is stored  for the Volume. To change the value for an existing Volume  you
2577    must use the {\bf update} command in the Console.  
2578
2579    If you are running multiple simultaneous jobs, this directive may not
2580    work correctly because when a drive is reserved for a job, this
2581    directive is not taken into account, so multiple jobs may try to 
2582    start writing to the Volume. At some point, when the Media record is
2583    updated, multiple simultaneous jobs may fail since the Volume can no
2584    longer be written.
2585
2586 \item [Maximum Volume Files = \lt{}positive-integer\gt{}]
2587    \index[dir]{Maximum Volume Files}
2588    \index[dir]{Directive!Maximum Volume Files}
2589    This directive specifies the maximum number of files that can be written
2590    to the Volume.  If you specify zero (the default), there is no limit.
2591    Otherwise, when the number of files written to the Volume equals {\bf
2592    positive-integer} the Volume will be marked {\bf Used}.  When the Volume
2593    is marked {\bf Used} it can no longer be used for appending Jobs, much
2594    like the {\bf Full} status but it can be recycled if recycling is
2595    enabled and thus used again.  This value is checked and the {\bf Used}
2596    status is set only at the end of a job that writes to the particular
2597    volume.
2598
2599    The value defined by this directive in the bacula-dir.conf file is the
2600    default value used when a Volume is created.  Once the volume is
2601    created, changing the value in the bacula-dir.conf file will not change
2602    what is stored for the Volume.  To change the value for an existing
2603    Volume you must use the {\bf update} command in the Console.
2604
2605 \item [Maximum Volume Bytes = \lt{}size\gt{}]
2606    \index[dir]{Maximum Volume Bytes}
2607    \index[dir]{Directive!Maximum Volume Bytes}
2608    This directive specifies the maximum number of bytes that can be written
2609    to the Volume.  If you specify zero (the default), there is no limit
2610    except the physical size of the Volume.  Otherwise, when the number of
2611    bytes written to the Volume equals {\bf size} the Volume will be marked
2612    {\bf Used}.  When the Volume is marked {\bf Used} it can no longer be
2613    used for appending Jobs, much like the {\bf Full} status but it can be
2614    recycled if recycling is enabled, and thus the Volume can be re-used
2615    after recycling.  This value is checked and the {\bf Used} status set
2616    while the job is writing to the particular volume.
2617
2618    This directive is particularly useful for restricting the size
2619    of disk volumes, and will work correctly even in the case of
2620    multiple simultaneous jobs writing to the volume.
2621
2622    The value defined by this directive in the bacula-dir.conf file is the
2623    default value used when a Volume is created.  Once the volume is
2624    created, changing the value in the bacula-dir.conf file will not change
2625    what is stored for the Volume.  To change the value for an existing
2626    Volume you must use the {\bf update} command in the Console.
2627
2628 \item [Volume Use Duration = \lt{}time-period-specification\gt{}]
2629    \index[dir]{Volume Use Duration}
2630    \index[dir]{Directive!Volume Use Duration}
2631    The Volume Use Duration directive defines the time period that the
2632    Volume can be written beginning from the time of first data write to the
2633    Volume.  If the time-period specified is zero (the default), the Volume
2634    can be written indefinitely.  Otherwise, the next time a job
2635    runs that wants to access this Volume, and the time period from the
2636    first write to the volume (the first Job written) exceeds the
2637    time-period-specification, the Volume will be marked {\bf Used}, which
2638    means that no more Jobs can be appended to the Volume, but it may be
2639    recycled if recycling is enabled. Using the command {\bf
2640    status dir} applies algorithms similar to running jobs, so
2641    during such a command, the Volume status may also be changed.
2642    Once the Volume is
2643    recycled, it will be available for use again.
2644    
2645    You might use this directive, for example, if you have a Volume used for
2646    Incremental backups, and Volumes used for Weekly Full backups.  Once the
2647    Full backup is done, you will want to use a different Incremental
2648    Volume.  This can be accomplished by setting the Volume Use Duration for
2649    the Incremental Volume to six days.  I.e.  it will be used for the 6
2650    days following a Full save, then a different Incremental volume will be
2651    used.  Be careful about setting the duration to short periods such as 23
2652    hours, or you might experience problems of Bacula waiting for a tape
2653    over the weekend only to complete the backups Monday morning when an
2654    operator mounts a new tape.
2655    
2656    The use duration is checked and the {\bf Used} status is set only at the
2657    end of a job that writes to the particular volume, which means that even
2658    though the use duration may have expired, the catalog entry will not be
2659    updated until the next job that uses this volume is run. This
2660    directive is not intended to be used to limit volume sizes
2661    and will not work correctly (i.e. will fail jobs) if the use
2662    duration expires while multiple simultaneous jobs are writing
2663    to the volume.
2664       
2665    Please note that the value defined by this directive in the  bacula-dir.conf
2666    file is the default value used when a Volume  is created. Once the volume is
2667    created, changing the value  in the bacula-dir.conf file will not change what
2668    is stored  for the Volume. To change the value for an existing Volume  you
2669    must use the 
2670    \ilink{\bf update volume}{UpdateCommand} command in the Console.  
2671
2672 \item [Catalog Files = \lt{}yes|no\gt{}]
2673    \index[dir]{Catalog Files}
2674    \index[dir]{Directive!Catalog Files}
2675    This directive defines whether or not you want the names of the files
2676    that were saved to be put into the catalog.  The default is {\bf yes}.
2677    The advantage of specifying {\bf Catalog Files = No} is that you will
2678    have a significantly smaller Catalog database.  The disadvantage is that
2679    you will not be able to produce a Catalog listing of the files backed up
2680    for each Job (this is often called Browsing).  Also, without the File
2681    entries in the catalog, you will not be able to use the Console {\bf
2682    restore} command nor any other command that references File entries.
2683    
2684 \label{PoolAutoPrune}
2685 \item [AutoPrune = \lt{}yes|no\gt{}]
2686    \index[dir]{AutoPrune}
2687    \index[dir]{Directive!AutoPrune}
2688    If AutoPrune is set to {\bf yes} (default), Bacula (version 1.20 or
2689    greater) will automatically apply the Volume Retention period when new
2690    Volume is needed and no appendable Volumes exist in the Pool.  Volume
2691    pruning causes expired Jobs (older than the {\bf Volume Retention}
2692    period) to be deleted from the Catalog and permits possible recycling of
2693    the Volume.
2694    
2695 \label{VolRetention}
2696 \item [Volume Retention = \lt{}time-period-specification\gt{}]
2697    \index[dir]{Volume Retention}
2698    \index[dir]{Directive!Volume Retention}
2699    The Volume Retention directive defines the length of time that {\bf
2700    Bacula} will keep records associated with the Volume in
2701    the Catalog database after the End time of each Job written to the
2702    Volume.  When this time period expires, and if {\bf AutoPrune} is set to
2703    {\bf yes} Bacula may prune (remove) Job records that are older than the
2704    specified Volume Retention period if it is necessary to free up a
2705    Volume.  Recycling will not occur until it is absolutely necessary to
2706    free up a volume (i.e. no other writable volume exists).
2707    All File records associated with pruned Jobs are also
2708    pruned.  The time may be specified as seconds, minutes, hours, days,
2709    weeks, months, quarters, or years.  The {\bf Volume Retention} is
2710    applied independently of the {\bf Job Retention} and the {\bf File
2711    Retention} periods defined in the Client resource.  This means that all
2712    the retentions periods are applied in turn and that the shorter period
2713    is the one that effectively takes precedence.  Note, that when the {\bf
2714    Volume Retention} period has been reached, and it is necessary to obtain
2715    a new volume, Bacula will prune both the Job and the File records.  This
2716    pruning could also occur during a {\bf status dir} command because it
2717    uses similar algorithms for finding the next available Volume.
2718
2719    It is important to know that when the Volume Retention period expires, 
2720    Bacula does not automatically recycle a Volume. It attempts to keep the
2721    Volume data intact as long as possible before over writing the Volume.
2722    
2723    
2724    By defining multiple Pools with different Volume Retention periods, you
2725    may effectively have a set of tapes that is recycled weekly, another
2726    Pool of tapes that is recycled monthly and so on.  However, one must
2727    keep in mind that if your {\bf Volume Retention} period is too short, it
2728    may prune the last valid Full backup, and hence until the next Full
2729    backup is done, you will not have a complete backup of your system, and
2730    in addition, the next Incremental or Differential backup will be
2731    promoted to a Full backup.  As a consequence, the minimum {\bf Volume
2732    Retention} period should be at twice the interval of your Full backups.
2733    This means that if you do a Full backup once a month, the minimum Volume
2734    retention period should be two months.
2735    
2736    The default Volume retention period is 365 days, and either the default
2737    or the value defined by this directive in the bacula-dir.conf file is
2738    the default value used when a Volume is created.  Once the volume is
2739    created, changing the value in the bacula-dir.conf file will not change
2740    what is stored for the Volume.  To change the value for an existing
2741    Volume you must use the {\bf update} command in the Console.
2742
2743 \label{PoolRecyclePool}
2744 \item [RecyclePool = \lt{}pool-resource-name\gt{}]
2745    \index[dir]{RecyclePool}
2746    \index[dir]{Directive!RecyclePool}
2747    On versions 2.1.4 or greater, this directive defines to which pool
2748    the Volume will be placed (moved) when it is recycled. Without
2749    this directive, a Volume will remain in the same pool when it is
2750    recycled. With this directive, it can be moved automatically to any
2751    existing pool during a recycle. This directive is probably most
2752    useful when defined in the Scratch pool, so that volumes will
2753    be recycled back into the Scratch pool. For more on the see the   
2754    \ilink{Scratch Pool}{TheScratchPool} section of this manual.
2755
2756    Although this directive is called RecyclePool, the Volume in
2757    question is actually moved from its current pool to the one
2758    you specify on this directive when Bacula prunes the Volume and
2759    discovers that there are no records left in the catalog and hence
2760    marks it as {\bf Purged}.
2761         
2762    
2763 \label{PoolRecycle}
2764 \item [Recycle = \lt{}yes|no\gt{}]
2765    \index[dir]{Recycle}
2766    \index[dir]{Directive!Recycle}
2767    This directive specifies whether or not Purged Volumes may be recycled.
2768    If it is set to {\bf yes} (default) and Bacula needs a volume but finds
2769    none that are appendable, it will search for and recycle (reuse) Purged
2770    Volumes (i.e.  volumes with all the Jobs and Files expired and thus
2771    deleted from the Catalog).  If the Volume is recycled, all previous data
2772    written to that Volume will be overwritten. If Recycle is set to {\bf
2773    no}, the Volume will not be recycled, and hence, the data will remain
2774    valid.  If you want to reuse (re-write) the Volume, and the recycle flag
2775    is no (0 in the catalog), you may manually set the recycle flag (update
2776    command) for a Volume to be reused.
2777
2778    Please note that the value defined by this directive in the
2779    bacula-dir.conf file is the default value used when a Volume is created.
2780    Once the volume is created, changing the value in the bacula-dir.conf
2781    file will not change what is stored for the Volume.  To change the value
2782    for an existing Volume you must use the {\bf update} command in the
2783    Console.
2784
2785    When all Job and File records have been pruned or purged from the      
2786    catalog for a particular Volume, if that Volume is marked as
2787    Append, Full, Used, or Error, it will then be marked as Purged. Only
2788    Volumes marked as Purged will be considered to be converted to the
2789    Recycled state if the {\bf Recycle} directive is set to {\bf yes}.
2790
2791
2792 \label{RecycleOldest}
2793 \item [Recycle Oldest Volume = \lt{}yes|no\gt{}]
2794    \index[dir]{Recycle Oldest Volume}
2795    \index[dir]{Directive!Recycle Oldest Volume}
2796    This directive instructs the Director to search for the oldest used
2797    Volume in the Pool when another Volume is requested by the Storage
2798    daemon and none are available.  The catalog is then {\bf pruned}
2799    respecting the retention periods of all Files and Jobs written to this
2800    Volume.  If all Jobs are pruned (i.e. the volume is Purged), then the
2801    Volume is recycled and will be used as the next Volume to be written.
2802    This directive respects any Job, File, or Volume retention periods that
2803    you may have specified, and as such it is {\bf much} better to use this
2804    directive than the Purge Oldest Volume.
2805
2806    This directive can be useful if you have a fixed number of Volumes in the
2807    Pool and you want to cycle through them and you have specified the correct
2808    retention periods.  
2809
2810    However, if you use this directive and have only one
2811    Volume in the Pool, you will immediately recycle your Volume if you fill
2812    it and Bacula needs another one. Thus your backup will be totally invalid.
2813    Please use this directive with care. The default is {\bf no}.
2814
2815 \label{RecycleCurrent}
2816
2817 \item [Recycle Current Volume = \lt{}yes|no\gt{}]
2818    \index[dir]{Recycle Current Volume}
2819    \index[dir]{Directive!Recycle Current Volume}
2820    If Bacula needs a new Volume, this directive instructs Bacula to Prune
2821    the volume respecting the Job and File retention periods.  If all Jobs
2822    are pruned (i.e.  the volume is Purged), then the Volume is recycled and
2823    will be used as the next Volume to be written.  This directive respects
2824    any Job, File, or Volume retention periods that you may have specified,
2825    and thus it is {\bf much} better to use it rather than the Purge Oldest
2826    Volume directive.
2827
2828    This directive can be useful if you have: a fixed number of Volumes in
2829    the Pool, you want to cycle through them, and you have specified
2830    retention periods that prune Volumes before you have cycled through the
2831    Volume in the Pool.
2832
2833    However, if you use this directive and have only one Volume in the Pool,
2834    you will immediately recycle your Volume if you fill it and Bacula needs
2835    another one.  Thus your backup will be totally invalid.  Please use this
2836    directive with care.  The default is {\bf no}.
2837
2838 \label{PurgeOldest}
2839
2840 \item [Purge Oldest Volume = \lt{}yes|no\gt{}]
2841    \index[dir]{Purge Oldest Volume}
2842    \index[dir]{Directive!Purge Oldest Volume}
2843    This directive instructs the Director to search for the oldest used
2844    Volume in the Pool when another Volume is requested by the Storage
2845    daemon and none are available.  The catalog is then {\bf purged}
2846    irrespective of retention periods of all Files and Jobs written to this
2847    Volume.  The Volume is then recycled and will be used as the next Volume
2848    to be written.  This directive overrides any Job, File, or Volume
2849    retention periods that you may have specified.
2850
2851    This directive can be useful if you have a fixed number of Volumes in
2852    the Pool and you want to cycle through them and reusing the oldest one
2853    when all Volumes are full, but you don't want to worry about setting
2854    proper retention periods.  However, by using this option you risk losing
2855    valuable data.
2856
2857    Please be aware that {\bf Purge Oldest Volume} disregards all retention
2858    periods. If you have only a single Volume defined and you turn this
2859    variable on, that Volume will always be immediately overwritten when it
2860    fills!  So at a minimum, ensure that you have a decent number of Volumes
2861    in your Pool before running any jobs.  If you want retention periods to
2862    apply do not use this directive.  To specify a retention period, use the
2863    {\bf Volume Retention} directive (see above).
2864
2865    We {\bf highly} recommend against using this directive, because it is
2866    sure that some day, Bacula will recycle a Volume that contains current
2867    data.  The default is {\bf no}.
2868
2869 \item [Cleaning Prefix = \lt{}string\gt{}]
2870    \index[dir]{Cleaning Prefix}
2871    \index[dir]{Directive!Cleaning Prefix}
2872    This directive defines a prefix string, which if it matches the
2873    beginning of a Volume name during labeling of a Volume, the Volume will
2874    be defined with the VolStatus set to {\bf Cleaning} and thus Bacula will
2875    never attempt to use this tape.  This is primarily for use with
2876    autochangers that accept barcodes where the convention is that barcodes
2877    beginning with {\bf CLN} are treated as cleaning tapes.
2878
2879 \label{Label}
2880 \item [Label Format = \lt{}format\gt{}]
2881    \index[dir]{Label Format}
2882    \index[dir]{Directive!Label Format}
2883    This directive specifies the format of the labels contained in this
2884    pool.  The format directive is used as a sort of template to create new
2885    Volume names during automatic Volume labeling.
2886
2887    The {\bf format} should be specified in double quotes, and consists of
2888    letters, numbers and the special characters hyphen ({\bf -}), underscore
2889    ({\bf \_}), colon ({\bf :}), and period ({\bf .}), which are the legal
2890    characters for a Volume name.  The {\bf format} should be enclosed in
2891    double quotes (").
2892
2893    In addition, the format may contain a number of variable expansion
2894    characters which will be expanded by a complex algorithm allowing you to
2895    create Volume names of many different formats.  In all cases, the
2896    expansion process must resolve to the set of characters noted above that
2897    are legal Volume names.  Generally, these variable expansion characters
2898    begin with a dollar sign ({\bf \$}) or a left bracket ({\bf [}).  If you
2899    specify variable expansion characters, you should always enclose the
2900    format with double quote characters ({\bf "}).  For more details on
2901    variable expansion, please see the \ilink{Variable
2902    Expansion}{VarsChapter} Chapter of this manual.
2903
2904    If no variable expansion characters are found in the string, the Volume
2905    name will be formed from the {\bf format} string appended with the
2906    a unique number that increases.  If you do not remove volumes from the
2907    pool, this number should be the number of volumes plus one, but this
2908    is not guaranteed. The unique number will be edited as four
2909    digits with leading zeros.  For example, with a {\bf Label Format =
2910    "File-"}, the first volumes will be named {\bf File-0001}, {\bf
2911    File-0002}, ...
2912
2913    With the exception of Job specific variables, you can test your {\bf
2914    LabelFormat} by using the \ilink{ var command}{var} the Console Chapter
2915    of this manual.
2916
2917    In almost all cases, you should enclose the format specification (part
2918    after the equal sign) in double quotes.  Please note that this directive
2919    is deprecated and is replaced in version 1.37 and greater with a Python
2920    script for creating volume names.
2921
2922 \end{description}
2923
2924 In order for a Pool to be used during a Backup Job, the Pool must have at
2925 least one Volume associated with it.  Volumes are created for a Pool using
2926 the {\bf label} or the {\bf add} commands in the {\bf Bacula Console},
2927 program.  In addition to adding Volumes to the Pool (i.e.  putting the
2928 Volume names in the Catalog database), the physical Volume must be labeled
2929 with a valid Bacula software volume label before {\bf Bacula} will accept
2930 the Volume.  This will be automatically done if you use the {\bf label}
2931 command.  Bacula can automatically label Volumes if instructed to do so,
2932 but this feature is not yet fully implemented.
2933
2934 The following is an example of a valid Pool resource definition: 
2935
2936 \footnotesize
2937 \begin{verbatim}
2938  
2939 Pool {
2940   Name = Default
2941   Pool Type = Backup
2942 }
2943 \end{verbatim}
2944 \normalsize
2945
2946 \subsection{The Scratch Pool}
2947 \label{TheScratchPool}
2948 \index[general]{Scratch Pool}
2949 In general, you can give your Pools any name you wish, but there is one 
2950 important restriction: the Pool named {\bf Scratch}, if it exists behaves 
2951 like a scratch pool of Volumes in that when Bacula needs a new Volume for 
2952 writing and it cannot find one, it will look in the Scratch pool, and if
2953 it finds an available Volume, it will move it out of the Scratch pool into
2954 the Pool currently being used by the job.
2955
2956
2957 \section{The Catalog Resource}
2958 \label{CatalogResource}
2959 \index[general]{Resource!Catalog}
2960 \index[general]{Catalog Resource}
2961
2962 The Catalog Resource defines what catalog to use for the current job.
2963 Currently, Bacula can only handle a single database server (SQLite, MySQL,
2964 PostgreSQL) that is defined when configuring {\bf Bacula}.  However, there
2965 may be as many Catalogs (databases) defined as you wish.  For example, you
2966 may want each Client to have its own Catalog database, or you may want
2967 backup jobs to use one database and verify or restore jobs to use another
2968 database. 
2969
2970 Since SQLite is compiled in, it always runs on the same machine
2971 as the Director and the database must be directly accessible (mounted) from
2972 the Director.  However, since both MySQL and PostgreSQL are networked
2973 databases, they may reside either on the same machine as the Director
2974 or on a different machine on the network.  See below for more details.
2975
2976 \begin{description}
2977
2978 \item [Catalog]
2979    \index[dir]{Catalog}
2980    \index[dir]{Directive!Catalog}
2981    Start of the Catalog resource.  At least one Catalog resource must be
2982 defined.
2983
2984
2985 \item [Name = \lt{}name\gt{}]
2986    \index[dir]{Name}
2987    \index[dir]{Directive!Name}
2988    The name of the Catalog.  No necessary relation to the database server
2989    name.  This name will be specified in the Client resource directive
2990    indicating that all catalog data for that Client is maintained in this
2991    Catalog.  This directive is required.
2992
2993 \item [password = \lt{}password\gt{}]
2994    \index[dir]{password}
2995    \index[dir]{Directive!password}
2996    This specifies the password to use when logging into the database.  This
2997    directive is required.
2998
2999 \item [DB Name = \lt{}name\gt{}]
3000    \index[dir]{DB Name}
3001    \index[dir]{Directive!DB Name}
3002    This specifies the name of the database.  If you use multiple catalogs
3003    (databases), you specify which one here.  If you are using an external
3004    database server rather than the internal one, you must specify a name
3005    that is known to the server (i.e.  you explicitly created the Bacula
3006    tables using this name.  This directive is required.
3007
3008 \item [user = \lt{}user\gt{}]
3009    \index[dir]{user}
3010    \index[dir]{Directive!user}
3011    This specifies what user name to use to log into the database.  This
3012    directive is required.
3013
3014 \item [DB Socket = \lt{}socket-name\gt{}]
3015    \index[dir]{DB Socket}
3016    \index[dir]{Directive!DB Socket}
3017    This is the name of  a socket to use on the local host to connect to the
3018    database. This directive is used only by MySQL and is ignored by  SQLite.
3019    Normally, if neither {\bf DB Socket} or {\bf DB Address}  are specified, MySQL
3020    will use the default socket. If the DB Socket is specified, the
3021    MySQL server must reside on the same machine as the Director.
3022
3023 \item [DB Address = \lt{}address\gt{}]
3024    \index[dir]{DB Address}
3025    \index[dir]{Directive!DB Address}
3026    This is the host address  of the database server. Normally, you would specify
3027    this instead  of {\bf DB Socket} if the database server is on another machine.
3028    In that case, you will also specify {\bf DB Port}. This directive  is used
3029    only by MySQL and PostgreSQL and is ignored by SQLite if provided.  
3030    This directive is optional.  
3031
3032 \item [DB Port = \lt{}port\gt{}]
3033    \index[dir]{DB Port}
3034    \index[dir]{Directive!DB Port}
3035    This defines the port to  be used in conjunction with {\bf DB Address} to
3036    access the  database if it is on another machine. This directive is used  only
3037    by MySQL and PostgreSQL and is ignored by SQLite if provided.  This
3038    directive is optional.
3039
3040 %% \item [Multiple Connections = \lt{}yes|no\gt{}]
3041 %% \index[dir]{Multiple Connections}
3042 %% \index[dir]{Directive!Multiple Connections}
3043 %% By default, this  directive is set to no. In that case, each job that uses
3044 the
3045 %% same Catalog will use a single connection to the catalog. It will  be shared,
3046 %% and Bacula will allow only one Job at a time to  communicate. If you set this
3047 %% directive to yes, Bacula will  permit multiple connections to the database,
3048 %% and the database  must be multi-thread capable. For SQLite and PostgreSQL,
3049 %% this is  no problem. For MySQL, you must be *very* careful to have the 
3050 %% multi-thread version of the client library loaded on your system.  When this
3051 %% directive is set yes, each Job will have a separate  connection to the
3052 %% database, and the database will control the  interaction between the
3053 different
3054 %% Jobs. This can significantly  speed up the database operations if you are
3055 %% running multiple  simultaneous jobs. In addition, for SQLite and PostgreSQL,
3056 %% Bacula  will automatically enable transactions. This can significantly  speed
3057 %% up insertion of attributes in the database either for  a single Job or
3058 %% multiple simultaneous Jobs.  
3059
3060 %% This directive has not been tested. Please test carefully  before running it
3061 %% in production and report back your results.  
3062
3063 \end{description}
3064
3065 The following is an example of a valid Catalog resource definition: 
3066
3067 \footnotesize
3068 \begin{verbatim}
3069 Catalog
3070 {
3071   Name = SQLite
3072   dbname = bacula;
3073   user = bacula;
3074   password = ""                       # no password = no security
3075 }
3076 \end{verbatim}
3077 \normalsize
3078
3079 or for a Catalog on another machine: 
3080
3081 \footnotesize
3082 \begin{verbatim}
3083 Catalog
3084 {
3085   Name = MySQL
3086   dbname = bacula
3087   user = bacula
3088   password = ""
3089   DB Address = remote.acme.com
3090   DB Port = 1234
3091 }
3092 \end{verbatim}
3093 \normalsize
3094
3095 \section{The Messages Resource}
3096 \label{MessagesResource2}
3097 \index[general]{Resource!Messages}
3098 \index[general]{Messages Resource}
3099
3100 For the details of the Messages Resource, please see the 
3101 \ilink{Messages Resource Chapter}{MessagesChapter} of this
3102 manual. 
3103
3104 \section{The Console Resource}
3105 \label{ConsoleResource1}
3106 \index[general]{Console Resource}
3107 \index[general]{Resource!Console}
3108
3109 As of Bacula version 1.33 and higher, there are three different kinds of
3110 consoles, which the administrator or user can use to interact with the
3111 Director. These three kinds of consoles comprise three different security
3112 levels. 
3113
3114 \begin{itemize}
3115 \item The first console type is an {\bf anonymous} or {\bf default}  console,
3116    which has full privileges.  There is no console resource necessary for
3117    this type since the password is specified in the Director's resource and
3118    consequently such consoles do not have a name as defined on a {\bf Name
3119    =} directive.  This is the kind of console that was initially
3120    implemented in versions prior to 1.33 and remains valid.  Typically you
3121    would use it only for  administrators.  
3122
3123 \item The second type of console, and new to version 1.33 and  higher is a
3124    "named" console defined within a Console resource in both the Director's
3125    configuration file and in the Console's configuration file.  Both the
3126    names and the passwords in these two entries must match much as is the
3127    case for Client programs.
3128
3129    This second type of console begins with absolutely no privileges except
3130    those explicitly specified in the Director's Console resource.  Thus you
3131    can have multiple Consoles with different names and passwords, sort of
3132    like multiple users, each with different privileges.  As a default,
3133    these consoles can do absolutely nothing -- no commands whatsoever.  You
3134    give them privileges or rather access to commands and resources by
3135    specifying access control lists in the Director's Console resource.  The
3136    ACLs are specified by a directive followed by a list of access names.
3137    Examples of this are shown below.
3138
3139 \item The third type of console is similar to the above mentioned  one in that
3140    it requires a Console resource definition in both the Director and the
3141    Console.  In addition, if the console name, provided on the {\bf Name =}
3142    directive, is the same as a Client name, that console is permitted to
3143    use the {\bf SetIP} command to change the Address directive in the
3144    Director's client resource to the IP address of the Console.  This
3145    permits portables or other machines using DHCP (non-fixed IP addresses)
3146    to "notify" the Director of their current IP address.
3147 \end{itemize}
3148
3149 The Console resource is optional and need not be specified. The following
3150 directives are permitted within the Director's configuration resource: 
3151
3152 \begin{description}
3153
3154 \item [Name = \lt{}name\gt{}]
3155    \index[dir]{Name}
3156    \index[dir]{Directive!Name}
3157    The name of the console. This  name must match the name specified in the
3158 Console's configuration  resource (much as is the case with Client
3159 definitions).  
3160
3161 \item [Password = \lt{}password\gt{}]
3162    \index[dir]{Password}
3163    \index[dir]{Directive!Password}
3164    Specifies the password that must be supplied for a named Bacula Console
3165    to be authorized.  The same password must appear in the {\bf Console}
3166    resource of the Console configuration file.  For added security, the
3167    password is never actually passed across the network but rather a
3168    challenge response hash code created with the password.  This directive
3169    is required.  If you have either {\bf /dev/random} {\bf bc} on your
3170    machine, Bacula will generate a random password during the configuration
3171    process, otherwise it will be left blank.
3172
3173    The password is plain text.  It is not generated through any special
3174    process.  However, it is preferable for security reasons to choose 
3175    random text.      
3176
3177 \item [JobACL = \lt{}name-list\gt{}]
3178    \index[dir]{JobACL}
3179    \index[dir]{Directive!JobACL}
3180    This directive is used to specify a list of Job resource names that can
3181    be accessed by the console.  Without this directive, the console cannot
3182    access any of the Director's Job resources.  Multiple Job resource names
3183    may be specified by separating them with commas, and/or by specifying
3184    multiple JobACL directives.  For example, the directive may be specified
3185    as:
3186
3187 \footnotesize
3188 \begin{verbatim}
3189     JobACL = kernsave, "Backup client 1", "Backup client 2"
3190     JobACL = "RestoreFiles"
3191     
3192 \end{verbatim}
3193 \normalsize
3194
3195 With the above specification, the console can access the Director's  resources
3196 for the four jobs named on the JobACL directives,  but for no others.  
3197
3198 \item [ClientACL = \lt{}name-list\gt{}]
3199    \index[dir]{ClientACL}
3200    \index[dir]{Directive!ClientACL}
3201    This directive is used to  specify a list of Client resource names that can
3202 be
3203 accessed by  the console.  
3204
3205 \item [StorageACL = \lt{}name-list\gt{}]
3206    \index[dir]{StorageACL}
3207    \index[dir]{Directive!StorageACL}
3208    This directive is used to  specify a list of Storage resource names that can
3209 be accessed by  the console.  
3210
3211 \item [ScheduleACL = \lt{}name-list\gt{}]
3212    \index[dir]{ScheduleACL}
3213    \index[dir]{Directive!ScheduleACL}
3214    This directive is used to  specify a list of Schedule resource names that can
3215    be accessed by the console.
3216
3217 \item [PoolACL = \lt{}name-list\gt{}]
3218    \index[dir]{PoolACL}
3219    \index[dir]{Directive!PoolACL}
3220    This directive is used to  specify a list of Pool resource names that can be
3221    accessed by the console.
3222
3223 \item [FileSetACL = \lt{}name-list\gt{}]
3224    \index[dir]{FileSetACL}
3225    \index[dir]{Directive!FileSetACL}
3226    This directive is used to specify a list of FileSet resource names that
3227    can be accessed by the console.
3228
3229 \item [CatalogACL = \lt{}name-list\gt{}]
3230    \index[dir]{CatalogACL}
3231    \index[dir]{Directive!CatalogACL}
3232    This directive is used to specify a list of Catalog resource names that
3233    can be accessed by the console.
3234
3235 \item [CommandACL = \lt{}name-list\gt{}]
3236    \index[dir]{CommandACL}
3237    \index[dir]{Directive!CommandACL}
3238    This directive is used to specify a list of of console commands that can
3239    be executed by the console.
3240
3241 \item [WhereACL = \lt{}string\gt{}]
3242    \index[dir]{WhereACL}
3243    \index[dir]{Directive!WhereACL}
3244    This directive permits you to specify where a restricted console
3245    can restore files. If this directive is not specified, only the
3246    default restore location is permitted (normally {\bf
3247    /tmp/bacula-restores}. If {\bf *all*} is specified any path the
3248    user enters will be accepted (not very secure), any other
3249    value specified (there may be multiple WhereACL directives) will
3250    restrict the user to use that path. For example, on a Unix system,
3251    if you specify "/", the file will be restored to the original 
3252    location.  This directive is untested.
3253
3254 \end{description}
3255
3256 Aside from Director resource names and console command names, the special
3257 keyword {\bf *all*} can be specified in any of the above access control lists.
3258 When this keyword is present, any resource or command name (which ever is
3259 appropriate) will be accepted. For an example configuration file, please see
3260 the 
3261 \ilink{Console Configuration}{ConsoleConfChapter} chapter of this
3262 manual. 
3263
3264 \section{The Counter Resource}
3265 \label{CounterResource}
3266 \index[general]{Resource!Counter}
3267 \index[general]{Counter Resource}
3268
3269 The Counter Resource defines a counter variable that can be accessed by
3270 variable expansion used for creating Volume labels with the {\bf LabelFormat}
3271 directive. See the 
3272 \ilink{LabelFormat}{Label} directive in this chapter for more
3273 details. 
3274
3275 \begin{description}
3276
3277 \item [Counter] 
3278    \index[dir]{Counter}
3279    \index[dir]{Directive!Counter}
3280    Start of the Counter resource.  Counter directives are optional. 
3281
3282 \item [Name = \lt{}name\gt{}]
3283    \index[dir]{Name}
3284    \index[dir]{Directive!Name}
3285    The name of the Counter.  This is the name you will use in the variable
3286 expansion  to reference the counter value.  
3287
3288 \item [Minimum = \lt{}integer\gt{}]
3289    \index[dir]{Minimum}
3290    \index[dir]{Directive!Minimum}
3291    This specifies the minimum  value that the counter can have. It also becomes
3292 the default.  If not supplied, zero is assumed.  
3293
3294 \item [Maximum = \lt{}integer\gt{}]
3295    \index[dir]{Maximum}
3296    \index[dir]{Directive!Maximum}
3297    \index[dir]{Directive!Maximum}
3298    This is the maximum value  value that the counter can have. If not specified
3299 or set to  zero, the counter can have a maximum value of 2,147,483,648  (2 to
3300 the 31 power). When the counter is incremented past  this value, it is reset
3301 to the Minimum.  
3302
3303 \item [*WrapCounter = \lt{}counter-name\gt{}]
3304    \index[dir]{*WrapCounter}
3305    \index[dir]{Directive!*WrapCounter}
3306    If this value  is specified, when the counter is incremented past the
3307 maximum 
3308 and thus reset to the minimum, the counter specified on the  {\bf WrapCounter}
3309 is incremented. (This is not currently  implemented). 
3310
3311 \item [Catalog = \lt{}catalog-name\gt{}]
3312    \index[dir]{Catalog}
3313    \index[dir]{Directive!Catalog}
3314    If this directive is  specified, the counter and its values will be saved in 
3315 the specified catalog. If this directive is not present, the  counter will be
3316 redefined each time that Bacula is started. 
3317 \end{description}
3318
3319 \section{Example Director Configuration File}
3320 \label{SampleDirectorConfiguration}
3321 \index[general]{File!Example Director Configuration}
3322 \index[general]{Example Director Configuration File}
3323
3324 An example Director configuration file might be the following: 
3325
3326 \footnotesize
3327 \begin{verbatim}
3328 #
3329 # Default Bacula Director Configuration file
3330 #
3331 #  The only thing that MUST be changed is to add one or more
3332 #   file or directory names in the Include directive of the
3333 #   FileSet resource.
3334 #
3335 #  For Bacula release 1.15 (5 March 2002) -- redhat
3336 #
3337 #  You might also want to change the default email address
3338 #   from root to your address.  See the "mail" and "operator"
3339 #   directives in the Messages resource.
3340 #
3341 Director {                            # define myself
3342   Name = rufus-dir
3343   QueryFile = "/home/kern/bacula/bin/query.sql"
3344   WorkingDirectory = "/home/kern/bacula/bin/working"
3345   PidDirectory = "/home/kern/bacula/bin/working"
3346   Password = "XkSfzu/Cf/wX4L8Zh4G4/yhCbpLcz3YVdmVoQvU3EyF/"
3347 }
3348 # Define the backup Job
3349 Job {
3350   Name = "NightlySave"
3351   Type = Backup
3352   Level = Incremental                 # default
3353   Client=rufus-fd
3354   FileSet="Full Set"
3355   Schedule = "WeeklyCycle"
3356   Storage = DLTDrive
3357   Messages = Standard
3358   Pool = Default
3359 }
3360 Job {
3361   Name = "Restore"
3362   Type = Restore
3363   Client=rufus-fd
3364   FileSet="Full Set"
3365   Where = /tmp/bacula-restores
3366   Storage = DLTDrive
3367   Messages = Standard
3368   Pool = Default
3369 }
3370    
3371 # List of files to be backed up
3372 FileSet {
3373   Name = "Full Set"
3374   Include {
3375     Options { signature=SHA1}
3376 #
3377 #  Put your list of files here, one per line or include an
3378 #    external list with:
3379 #
3380 #    @file-name
3381 #
3382 #  Note: / backs up everything
3383   File = /
3384 }
3385   Exclude {}
3386 }
3387 # When to do the backups
3388 Schedule {
3389   Name = "WeeklyCycle"
3390   Run = level=Full sun at 2:05
3391   Run = level=Incremental mon-sat at 2:05
3392 }
3393 # Client (File Services) to backup
3394 Client {
3395   Name = rufus-fd
3396   Address = rufus
3397   Catalog = MyCatalog
3398   Password = "MQk6lVinz4GG2hdIZk1dsKE/LxMZGo6znMHiD7t7vzF+"
3399   File Retention = 60d      # sixty day file retention
3400   Job Retention = 1y        # 1 year Job retention
3401   AutoPrune = yes           # Auto apply retention periods
3402 }
3403 # Definition of DLT tape storage device
3404 Storage {
3405   Name = DLTDrive
3406   Address = rufus
3407   Password = "jMeWZvfikUHvt3kzKVVPpQ0ccmV6emPnF2cPYFdhLApQ"
3408   Device = "HP DLT 80"      # same as Device in Storage daemon
3409   Media Type = DLT8000      # same as MediaType in Storage daemon
3410 }
3411 # Definition for a DLT autochanger device
3412 Storage {
3413   Name = Autochanger
3414   Address = rufus
3415   Password = "jMeWZvfikUHvt3kzKVVPpQ0ccmV6emPnF2cPYFdhLApQ"
3416   Device = "Autochanger"    # same as Device in Storage daemon
3417   Media Type = DLT-8000     # Different from DLTDrive
3418   Autochanger = yes
3419 }
3420 # Definition of DDS tape storage device
3421 Storage {
3422   Name = SDT-10000
3423   Address = rufus
3424   Password = "jMeWZvfikUHvt3kzKVVPpQ0ccmV6emPnF2cPYFdhLApQ"
3425   Device = SDT-10000        # same as Device in Storage daemon
3426   Media Type = DDS-4        # same as MediaType in Storage daemon
3427 }
3428 # Definition of 8mm tape storage device
3429 Storage {
3430   Name = "8mmDrive"
3431   Address = rufus
3432   Password = "jMeWZvfikUHvt3kzKVVPpQ0ccmV6emPnF2cPYFdhLApQ"
3433   Device = "Exabyte 8mm"
3434   MediaType = "8mm"
3435 }
3436 # Definition of file storage device
3437 Storage {
3438   Name = File
3439   Address = rufus
3440   Password = "jMeWZvfikUHvt3kzKVVPpQ0ccmV6emPnF2cPYFdhLApQ"
3441   Device = FileStorage
3442   Media Type = File
3443 }
3444 # Generic catalog service
3445 Catalog {
3446   Name = MyCatalog
3447   dbname = bacula; user = bacula; password = ""
3448 }
3449 # Reasonable message delivery -- send most everything to
3450 #   the email address and to the console
3451 Messages {
3452   Name = Standard
3453   mail = root@localhost = all, !skipped, !terminate
3454   operator = root@localhost = mount
3455   console = all, !skipped, !saved
3456 }
3457     
3458 # Default pool definition
3459 Pool {
3460   Name = Default
3461   Pool Type = Backup
3462   AutoPrune = yes
3463   Recycle = yes
3464 }
3465 #
3466 # Restricted console used by tray-monitor to get the status of the director
3467 #
3468 Console {
3469   Name = Monitor
3470   Password = "GN0uRo7PTUmlMbqrJ2Gr1p0fk0HQJTxwnFyE4WSST3MWZseR"
3471   CommandACL = status, .status
3472 }
3473 \end{verbatim}
3474 \normalsize