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