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