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