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