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