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