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