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