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