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