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