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