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