]> git.sur5r.net Git - bacula/docs/blob - docs/manuals/en/main/dirdconf.tex
main manual first try
[bacula/docs] / docs / manuals / en / main / dirdconf.tex
1 %%
2 %%
3
4 \chapter{Configuring the Director}
5 \label{DirectorChapter}
6 \index[general]{Director!Configuring the}
7 \index[general]{Configuring the Director}
8
9 Of all the configuration files needed to run {\bf Bacula}, the Director's is
10 the most complicated, and the one that you will need to modify the most often
11 as you add clients or modify the FileSets.
12
13 For a general discussion of configuration files and resources including the
14 data types recognized by {\bf Bacula}. Please see the
15 \ilink{Configuration}{ConfigureChapter} chapter of this manual.
16
17 \section{Director Resource Types}
18 \index[general]{Types!Director Resource}
19 \index[general]{Director Resource Types}
20
21 Director resource type may be one of the following:
22
23 Job, JobDefs, Client, Storage, Catalog, Schedule, FileSet, Pool, Director,  or
24 Messages. We present them here in the most logical order for defining them:
25
26 Note, everything revolves around a job and is tied to a job in one
27 way or another.
28
29 \begin{bsysitemize}
30 \item
31    \ilink{Director}{DirectorResource4} -- to  define the Director's
32    name and its access password used for authenticating the Console program.
33    Only a single  Director resource definition may appear in the Director's
34    configuration file.  If you have either {\bf /dev/random} or  {\bf bc} on your
35    machine, Bacula will generate a random password during the configuration
36    process, otherwise it will  be left blank.
37 \item
38    \ilink{Job}{JobResource} -- to define the backup/restore Jobs
39    and to tie together the Client, FileSet and Schedule resources to  be used
40    for each Job. Normally, you will Jobs of different names corresponding
41    to each client (i.e. one Job per client, but a different one with a different name
42    for each client).
43 \item
44    \ilink{JobDefs}{JobDefsResource} -- optional resource for
45    providing defaults for Job resources.
46 \item
47    \ilink{Schedule}{ScheduleResource} -- to define when a Job is to
48    be automatically run by {\bf Bacula's} internal scheduler. You
49    may have any number of Schedules, but each job will reference only
50    one.
51 \item
52    \ilink{FileSet}{FileSetResource} -- to define the set of files
53    to be backed up for each Client. You may have any number of
54    FileSets but each Job will reference only one.
55 \item
56    \ilink{Client}{ClientResource2} -- to define what Client is to be
57    backed up. You will generally have multiple Client definitions. Each
58    Job will reference only a single client.
59 \item
60    \ilink{Storage}{StorageResource2} -- to define on what physical
61    device the Volumes should be mounted. You may have one or
62    more Storage definitions.
63 \item
64    \ilink{Pool}{PoolResource} -- to define the pool of Volumes
65    that can be used for a particular Job. Most people use a
66    single default Pool.  However, if you have a large number
67    of clients or volumes, you may want to have multiple Pools.
68    Pools allow you to restrict a Job (or a Client) to use
69    only a particular set of Volumes.
70 \item
71    \ilink{Catalog}{CatalogResource} -- to define in what database to
72    keep the list of files and the Volume names where they are backed up.
73    Most people only use a single catalog.  However, if you want to
74    scale the Director to many clients, multiple catalogs can be helpful.
75    Multiple catalogs require a bit more management because in general
76    you must know what catalog contains what data.  Currently, all
77    Pools are defined in each catalog.  This restriction will be removed
78    in a later release.
79 \item
80    \ilink{Messages}{MessagesChapter} -- to define where error and
81    information messages are to be sent or logged. You may define
82    multiple different message resources and hence direct particular
83    classes of messages to different users or locations (files, \ldots{}).
84 \end{bsysitemize}
85
86 \label{DirectorResource4}
87 \section{The Director Resource}
88 \index[general]{Director Resource}
89 \index[general]{Resource!Director}
90
91 The Director resource defines the attributes of the Directors running on the
92 network. In the current implementation, there is only a single Director
93 resource, but the final design will contain multiple Directors to maintain
94 index and media database redundancy.
95
96 \begin{description}
97
98 \item [Director]
99    \index[dir]{Director}
100    Start of the Director resource. One and only one  director resource must be
101 supplied.
102
103 \label{Director:Name}
104 \item [Name = \lt{}name\gt{}]
105    \index[dir]{Name}
106    \index[dir]{Directive!Name}
107    The director name used by the system  administrator. This directive is
108 required.
109
110 \label{Director:Description}
111 \item [Description = \lt{}text\gt{}]
112    \index[dir]{Description}
113    \index[dir]{Directive!Description}
114    The text field contains a  description of the Director that will be displayed
115 in the  graphical user interface. This directive is optional.
116
117 \label{Director:Password}
118 \item [Password = \lt{}UA-password\gt{}]
119    \index[dir]{Password}
120    \index[dir]{Directive!Password}
121    Specifies the password that must be supplied for the default Bacula
122    Console to be authorized.  The same password must appear in the {\bf
123    Director} resource of the Console configuration file.  For added
124    security, the password is never passed across the network but instead a
125    challenge response hash code created with the password.  This directive
126    is required.  If you have either {\bf /dev/random} or {\bf bc} on your
127    machine, Bacula will generate a random password during the configuration
128    process, otherwise it will be left blank and you must manually supply
129    it.
130
131    The password is plain text.  It is not generated through any special
132    process but as noted above, it is better to use random text for
133    security reasons.
134
135    \label{Director:Messages}
136 \item [Messages = \lt{}Messages-resource-name\gt{}]
137    \index[dir]{Directive!Messages}
138    The messages resource  specifies where to deliver Director messages that are
139    not associated  with a specific Job. Most messages are specific to a job and
140    will  be directed to the Messages resource specified by the job. However,
141    there are a few messages that can occur when no job is running.  This
142    directive is required.
143
144    \label{Director:WorkingDirectory}
145 \item [Working Directory = \lt{}Directory\gt{}]
146    \index[dir]{Working Directory}
147    \index[dir]{Directive!Working Directory}
148    This directive  is mandatory and specifies a directory in which the Director
149    may put its status files. This directory should be used only  by Bacula but
150    may be shared by other Bacula daemons. However, please note, if this
151    directory is shared with other Bacula daemons (the File daemon and Storage
152    daemon), you must ensure that the {\bf Name} given to each daemon is
153    unique so that the temporary filenames used do not collide.  By default
154    the Bacula configure process creates unique daemon names by postfixing them
155    with -dir, -fd, and -sd. Standard shell expansion of the {\bf
156    Directory}  is done when the configuration file is read so that values such
157    as {\bf \$HOME} will be properly expanded. This directive is required.
158    The working directory specified must already exist and be
159    readable and writable by the Bacula daemon referencing it.
160
161    If you have specified a Director user and/or a Director group on your
162    ./configure line with {\bf {-}{-}with-dir-user} and/or
163    {\bf {-}{-}with-dir-group} the Working Directory owner and group will
164    be set to those values.
165
166    \label{Director:PidDirectory}
167 \item [Pid Directory = \lt{}Directory\gt{}]
168    \index[dir]{Pid Directory}
169    \index[dir]{Directive!Pid Directory}
170    This directive  is mandatory and specifies a directory in which the Director
171    may put its process Id file. The process Id file is used to  shutdown
172    Bacula and to prevent multiple copies of  Bacula from running simultaneously.
173    Standard shell expansion of the {\bf Directory}  is done when the
174    configuration file is read so that values such  as {\bf \$HOME} will be
175    properly expanded.
176
177    The PID directory specified must already exist and be
178    readable and writable by the Bacula daemon referencing it
179
180    Typically on Linux systems, you will set this to:  {\bf /var/run}. If you are
181    not installing Bacula in the  system directories, you can use the {\bf Working
182    Directory} as  defined above.  This directive is required.
183
184    \label{Director:ScriptsDirectory}
185 \item [Scripts Directory = \lt{}Directory\gt{}]
186    \index[dir]{Scripts Directory}
187    \index[dir]{Directive!Scripts Directory}
188    This directive is optional and, if defined, specifies a directory in
189    which the Director will look for the Python startup script {\bf
190    DirStartup.py}.  This directory may be shared by other Bacula daemons.
191    Standard shell expansion of the directory is done when the configuration
192    file is read so that values such as {\bf \$HOME} will be properly
193    expanded.
194
195    \label{Director:QueryFile}
196 \item [QueryFile = \lt{}Path\gt{}]
197    \index[dir]{QueryFile}
198    \index[dir]{Directive!QueryFile}
199    This directive is mandatory and specifies a directory and file in which
200    the Director can find the canned SQL statements for the {\bf Query}
201    command of the Console.  Standard shell expansion of the {\bf Path} is
202    done when the configuration file is read so that values such as {\bf
203    \$HOME} will be properly expanded.  This directive is required.
204
205    \label{Director:HeartbeatInterval}
206 \item [Heartbeat Interval = \lt{}time-interval\gt{}]
207    \index[dir]{Heartbeat Interval}
208    \index[dir]{Directive!Heartbeat}
209    This directive is optional and if specified will cause the Director to
210    set a keepalive interval (heartbeat) in seconds on each of the sockets
211    it opens for the Client resource.  This value will override any
212    specified at the Director level.  It is implemented only on systems
213    (Linux, \ldots{}) that provide the {\bf setsockopt} TCP\_KEEPIDLE function.
214    The default value is zero, which means no change is made to the socket.
215
216 \label{DirMaxConJobs}
217
218    \label{Director:MaximumConcurrentJobs}
219 \item [Maximum Concurrent Jobs = \lt{}number\gt{}]
220    \index[dir]{Maximum Concurrent Jobs}
221    \index[dir]{Directive!Maximum Concurrent Jobs}
222    \index[general]{Simultaneous Jobs}
223    \index[general]{Concurrent Jobs}
224    where \lt{}number\gt{}  is the maximum number of total Director Jobs that
225    should run  concurrently. The default is set to 1, but you may set it to a
226    larger number.
227
228    The Volume format becomes more complicated with
229    multiple simultaneous jobs, consequently, restores may take longer if
230    Bacula must sort through interleaved volume blocks from  multiple simultaneous
231    jobs. This can be avoided by having each simultaneous job write to
232    a different volume or  by using data spooling, which will first spool the data
233    to disk simultaneously, then write one spool file at a time to the volume
234    thus avoiding excessive interleaving of the different job blocks.
235
236    \label{Director:FdConnectTimeout}
237 \item [FD Connect Timeout = \lt{}time\gt{}]
238    \index[dir]{FD Connect Timeout}
239    \index[dir]{Directive!FD Connect Timeout}
240    where {\bf time} is the time that the Director should continue
241    attempting to contact the File daemon to start a job, and after which
242    the Director will cancel the job.  The default is 30 minutes.
243
244    \label{Director:SdConnectTimeout}
245 \item [SD Connect Timeout = \lt{}time\gt{}]
246    \index[dir]{SD Connect Timeout}
247    \index[dir]{Directive!SD Connect Timeout}
248    where {\bf time} is the time that the Director should continue
249    attempting to contact the Storage daemon to start a job, and after which
250    the Director will cancel the job.  The default is 30 minutes.
251
252    \label{Director:DirAddresses}
253 \item [DirAddresses = \lt{}IP-address-specification\gt{}]
254    \index[dir]{DirAddresses}
255    \index[dir]{Address}
256    \index[general]{Address}
257    \index[dir]{Directive!DirAddresses}
258    Specify the ports and addresses on which the Director daemon will listen
259    for Bacula Console connections.  Probably the simplest way to explain
260    this is to show an example:
261
262 \footnotesize
263 \begin{lstlisting}
264  DirAddresses  = {
265     ip = { addr = 1.2.3.4; port = 1205;}
266     ipv4 = {
267         addr = 1.2.3.4; port = http;}
268     ipv6 = {
269         addr = 1.2.3.4;
270         port = 1205;
271     }
272     ip = {
273         addr = 1.2.3.4
274         port = 1205
275     }
276     ip = { addr = 1.2.3.4 }
277     ip = { addr = 201:220:222::2 }
278     ip = {
279         addr = bluedot.thun.net
280     }
281 }
282 \end{lstlisting}
283 \normalsize
284
285 where ip, ip4, ip6, addr, and port are all keywords. Note, that  the address
286 can be specified as either a dotted quadruple, or  IPv6 colon notation, or as
287 a symbolic name (only in the ip specification).  Also, port can be specified
288 as a number or as the mnemonic value from  the /etc/services file.  If a port
289 is not specified, the default will be used. If an ip  section is specified,
290 the resolution can be made either by IPv4 or  IPv6. If ip4 is specified, then
291 only IPv4 resolutions will be permitted,  and likewise with ip6.
292
293 Please note that if you use the DirAddresses directive, you must
294 not use either a DirPort or a DirAddress directive in the same
295 resource.
296
297    \label{Director:DirPort}
298 \item [DirPort = \lt{}port-number\gt{}]
299    \index[dir]{DirPort}
300    \index[dir]{Directive!DirPort}
301    Specify the port (a positive  integer) on which the  Director daemon will
302    listen for Bacula Console connections.  This same port number must be
303    specified in the Director resource  of the Console configuration file. The
304    default is 9101, so  normally this directive need not be specified.  This
305    directive should not be used if you specify DirAddresses (N.B plural)
306    directive.
307
308    \label{Director:DirAddress}
309 \item [DirAddress = \lt{}IP-Address\gt{}]
310    \index[dir]{DirAddress}
311    \index[dir]{Directive!DirAddress}
312    This directive is optional, but if it is specified, it will cause the
313    Director server (for the Console program) to bind to the specified {\bf
314      IP-Address}, which is either a domain name or an IP address specified as a
315    dotted quadruple in string or quoted string format.  If this directive is
316    not specified, the Director will bind to any available address (the
317    default).  Note, unlike the DirAddresses specification noted above, this
318    directive only permits a single address to be specified.  This directive
319    should not be used if you specify a DirAddresses (N.B. plural) directive.
320
321    \label{Director:DirSourceAddress}
322 \item [DirSourceAddress = \lt{}IP-Address\gt{}]
323    \index[fd]{DirSourceAddress}
324    \index[fd]{Directive!DirSourceAddress}
325    This record is optional, and if it is specified, it will cause the Director
326    server (when initiating connections to a storage or file daemon) to source
327    its connections from the specified address.  Only a single IP address may be
328    specified.  If this record is not specified, the Director server will source
329    its outgoing connections according to the system routing table (the default).
330
331 \phantomsection
332 \label{Director:StatisticsRetention}
333 \item[Statistics Retention = \lt{}time\gt{}]
334    \index[dir]{StatisticsRetention}
335    \label{PruneStatistics}
336    \index[dir]{Directive!StatisticsRetention}
337
338    The \texttt{Statistics Retention} directive defines the length of time that
339    Bacula will keep statistics job records in the Catalog database after the
340    Job End time. (In \texttt{JobHistory} table) When this time period expires,
341    and if user runs \texttt{prune stats} command, Bacula will prune (remove)
342    Job records that are older than the specified period.
343
344    Theses statistics records aren't use for restore purpose, but mainly for
345    capacity planning, billings, etc. See \ilink{Statistics chapter}{UseBaculaCatalogToExtractInformationChapter} for
346    additional information.
347
348    See the \ilink{ Configuration chapter}{Time} of this manual for additional
349    details of time specification.
350
351    The default is 5 years.
352
353   \label{Director:VerId}
354 \item[VerId = \lt{}string\gt{}]
355   \index[dir]{Directive!VerId}
356   where  \lt{}string\gt{} is an identifier which can be used for support purpose.
357   This string is displayed using the \texttt{version} command.
358
359   \label{Director:MaximumConsoleConnections}
360 \item[MaximumConsoleConnections = \lt{}number\gt{}]
361   \index[dir]{MaximumConsoleConnections}
362   \index[dir]{Directive!MaximumConsoleConnections}
363   \index[dir]{Console}
364    where \lt{}number\gt{}  is the maximum number of Console Connections that
365    could run  concurrently. The default is set to 20, but you may set it to a
366    larger number.
367
368 \label{Director:MaximumReloadRequests}
369  \item[MaximumReloadRequests = \lt{}number\gt{}]
370 \index[dir]{MaximumReloadRequests}
371 \index[dir]{Directive!MaximumReloadRequests}
372 \index[dir]{Console}
373
374 Where \lt{}number\gt{} is the maximum number of \texttt{reload} command that
375 can be done while jobs are running. The default is set to 32 and is usually
376 sufficient.
377
378 %   \label{Director:SharedStorage}
379 %\item[SharedStorage = \lt{}yes\vb{}no\gt{}]
380 %   \index[dir]{SharedStorage}
381 %   \index[dir]{Directive!SharedStorage}
382 %
383 %   The \texttt{Shared Storage} directive is a Bacula Enterprise feature that
384 %   allows you to share volumes between different Storage resources. This
385 %   directive should be used \textbf{only} if all \texttt{Media Type} are
386 %   correctly set across all Devices.
387 %
388 %   The \texttt{Shared Storage} directive should be used when using the SAN
389 %   Shared Storage plugin or when accessing from the Director Storage resources
390 %   directly to Devices of an Autochanger.
391 %
392 %   When sharing volumes between different Storage resources, you will
393 %   need also to use the \texttt{reset-storageid} script before using the
394 %   \texttt{update slots} command. This script can be scheduled once a day in
395 %   an Admin job.
396 %
397 %\begin{lstlisting}
398 % $ /opt/bacula/scripts/reset-storageid MediaType StorageName
399 % $ bconsole
400 % * update slots storage=StorageName drive=0
401 %\end{lstlisting}
402 %
403 %   Please contact Bacula Systems support to get help on this advanced
404 %   configuration.
405
406 \end{description}
407
408 The following is an example of a valid Director resource definition:
409
410 \footnotesize
411 \begin{lstlisting}
412 Director {
413   Name = HeadMan
414   WorkingDirectory = "$HOME/bacula/bin/working"
415   Password = UA_password
416   PidDirectory = "$HOME/bacula/bin/working"
417   QueryFile = "$HOME/bacula/bin/query.sql"
418   Messages = Standard
419 }
420 \end{lstlisting}
421 \normalsize
422
423 \label{JobResource}
424 \section{The Job Resource}
425 \index[general]{Resource!Job}
426 \index[general]{Job Resource}
427
428 The Job resource defines a Job (Backup, Restore, \ldots{}) that Bacula must
429 perform. Each Job resource definition contains the name of a Client and
430 a FileSet to backup, the Schedule for the Job, where the data
431 are to be stored, and what media Pool can be used. In effect, each Job
432 resource must specify What, Where, How, and When or FileSet, Storage,
433 Backup/Restore/Level, and Schedule respectively. Note, the FileSet must
434 be specified for a restore job for historical reasons, but it is no longer used.
435
436 Only a single type ({\bf Backup}, {\bf Restore}, \ldots{}) can be specified for any
437 job. If you want to backup multiple FileSets on the same Client or multiple
438 Clients, you must define a Job for each one.
439
440 Note, you define only a single Job to do the Full, Differential, and
441 Incremental backups since the different backup levels are tied together by
442 a unique Job name.  Normally, you will have only one Job per Client, but
443 if a client has a really huge number of files (more than several million),
444 you might want to split it into to Jobs each with a different FileSet
445 covering only part of the total files.
446
447 Multiple Storage daemons are not currently supported for Jobs, so if
448 you do want to use multiple storage daemons, you will need to create
449 a different Job and ensure that for each Job that the combination of
450 Client and FileSet are unique.  The Client and FileSet are what Bacula
451 uses to restore a client, so if there are multiple Jobs with the same
452 Client and FileSet or multiple Storage daemons that are used, the
453 restore will not work.  This problem can be resolved by defining multiple
454 FileSet definitions (the names must be different, but the contents of
455 the FileSets may be the same).
456
457
458 \begin{description}
459
460 \item [Job]
461    \index[dir]{Job}
462    \index[dir]{Directive!Job}
463    Start of the Job resource. At least one Job  resource is required.
464
465    \label{Job:Name}
466 \item [Name = \lt{}name\gt{}]
467    \index[dir]{Name}
468    \index[dir]{Directive!Name}
469    The Job name. This name can be specified  on the {\bf Run} command in the
470    console program to start a job. If the  name contains spaces, it must be
471    specified between quotes. It is  generally a good idea to give your job the
472    same name as the Client  that it will backup. This permits easy
473    identification of jobs.
474
475    When the job actually runs, the unique Job Name will consist  of the name you
476    specify here followed by the date and time the  job was scheduled for
477    execution. This directive is required.
478
479   \label{Job:Enable}
480 \item [Enabled = \lt{}yes\vb{}no\gt{}]
481   \index[dir]{Enable}
482   \index[dir]{Directive!Enable}
483   This directive allows you to enable or disable automatic execution
484   via the scheduler of a Job.
485
486    \label{Job:Type}
487 \item [Type = \lt{}job-type\gt{}]
488    \index[dir]{Type}
489    \index[dir]{Directive!Type}
490    The {\bf Type} directive specifies  the Job type, which may be one of the
491    following: {\bf Backup},  {\bf Restore}, {\bf Verify}, or {\bf Admin}. This
492    directive  is required. Within a particular Job Type, there are also Levels
493    as discussed in the next item.
494
495 \begin{description}
496
497 \item [Backup]
498    \index[dir]{Backup}
499    Run a backup Job. Normally you will  have at least one Backup job for each
500    client you want  to save. Normally, unless you turn off cataloging,  most all
501    the important statistics and data concerning  files backed up will be placed
502    in the catalog.
503
504 \item [Restore]
505    \index[dir]{Restore}
506    Run a restore Job.  Normally, you will specify only one Restore job
507    which acts as a sort of prototype that you will modify using the console
508    program in order to perform restores.  Although certain basic
509    information from a Restore job is saved in the catalog, it is very
510    minimal compared to the information stored for a Backup job -- for
511    example, no File database entries are generated since no Files are
512    saved.
513
514    {\bf Restore} jobs cannot be
515    automatically started by the scheduler as is the case for Backup, Verify
516    and Admin jobs. To restore files, you must use the {\bf restore} command
517    in the console.
518
519
520 \item [Verify]
521    \index[dir]{Verify}
522    Run a verify Job. In general, {\bf verify}  jobs permit you to compare the
523    contents of the catalog  to the file system, or to what was backed up. In
524    addition,  to verifying that a tape that was written can be read,  you can
525    also use {\bf verify} as a sort of tripwire  intrusion detection.
526
527 \item [Admin]
528    \index[dir]{Admin}
529    Run an admin Job. An {\bf Admin} job can  be used to periodically run catalog
530    pruning, if you  do not want to do it at the end of each {\bf Backup}  Job.
531    Although an Admin job is recorded in the  catalog, very little data is saved.
532 \end{description}
533 \label{Level}
534
535
536 \label{Job:Level}
537 \item [Level = \lt{}job-level\gt{}]
538 \index[dir]{Level}
539 \index[dir]{Directive!Level}
540    The Level directive specifies the default Job level to be run.  Each
541    different Job Type (Backup, Restore, \ldots{}) has a different set of Levels
542    that can be specified.  The Level is normally overridden by a different
543    value that is specified in the {\bf Schedule} resource.  This directive
544    is not required, but must be specified either by a {\bf Level} directive
545    or as an override specified in the {\bf Schedule} resource.
546
547 For a {\bf Backup} Job, the Level may be one of the  following:
548
549 \begin{description}
550
551 \item [Full]
552 \index[dir]{Full}
553    When the Level is set to Full all files in the FileSet whether or not
554    they have changed will be backed up.
555
556 \item [Incremental]
557    \index[dir]{Incremental}
558    When the Level is set to Incremental all files specified in the FileSet
559    that have changed since the last successful backup of the the same Job
560    using the same FileSet and Client, will be backed up.  If the Director
561    cannot find a previous valid Full backup then the job will be upgraded
562    into a Full backup.  When the Director looks for a valid backup record
563    in the catalog database, it looks for a previous Job with:
564
565 \begin{bsysitemize}
566 \item The same Job name.
567 \item The same Client name.
568 \item The same FileSet (any change to the definition of  the FileSet such as
569    adding or deleting a file in the  Include or Exclude sections constitutes a
570    different FileSet.
571 \item The Job was a Full, Differential, or Incremental backup.
572 \item The Job terminated normally (i.e. did not fail or was not  canceled).
573 \item The Job started no longer ago than {\bf Max Full Interval}.
574 \end{bsysitemize}
575
576    If all the above conditions do not hold, the Director will upgrade  the
577    Incremental to a Full save. Otherwise, the Incremental  backup will be
578    performed as requested.
579
580    The File daemon (Client) decides which files to backup for an
581    Incremental backup by comparing start time of the prior Job (Full,
582    Differential, or Incremental) against the time each file was last
583    ``modified'' (st\_mtime) and the time its attributes were last
584    ``changed''(st\_ctime).  If the file was modified or its attributes
585    changed on or after this start time, it will then be backed up.
586
587    Some virus scanning software may change st\_ctime while
588    doing the scan.  For example, if the virus scanning program attempts to
589    reset the access time (st\_atime), which Bacula does not use, it will
590    cause st\_ctime to change and hence Bacula will backup the file during
591    an Incremental or Differential backup.  In the case of Sophos virus
592    scanning, you can prevent it from resetting the access time (st\_atime)
593    and hence changing st\_ctime by using the {\bf \verb:--:no-reset-atime}
594    option.  For other software, please see their manual.
595
596    When Bacula does an Incremental backup, all modified files that are
597    still on the system are backed up.  However, any file that has been
598    deleted since the last Full backup remains in the Bacula catalog,
599    which means that if between a Full save and the time you do a
600    restore, some files are deleted, those deleted files will also be
601    restored.  The deleted files will no longer appear in the catalog
602    after doing another Full save.
603
604    In addition, if you move a directory rather than copy it, the files in
605    it do not have their modification time (st\_mtime) or their attribute
606    change time (st\_ctime) changed.  As a consequence, those files will
607    probably not be backed up by an Incremental or Differential backup which
608    depend solely on these time stamps.  If you move a directory, and wish
609    it to be properly backed up, it is generally preferable to copy it, then
610    delete the original.
611
612    However, to manage deleted files or directories changes in the
613    catalog during an Incremental backup you can use \texttt{accurate}
614    mode. This is quite memory consuming process. See \ilink{Accurate
615      mode}{accuratemode} for more details.
616
617 \item [Differential]
618    \index[dir]{Differential}
619    When the Level is set to Differential
620    all files specified in the FileSet that have changed since the last
621    successful Full backup of the same Job will be backed up.
622    If the Director cannot find a
623    valid previous Full backup for the same Job, FileSet, and Client,
624    backup, then the Differential job will be upgraded into a Full backup.
625    When the Director looks for a valid Full backup record in the catalog
626    database, it looks for a previous Job with:
627
628 \begin{bsysitemize}
629 \item The same Job name.
630 \item The same Client name.
631 \item The same FileSet (any change to the definition of  the FileSet such as
632    adding or deleting a file in the  Include or Exclude sections constitutes a
633    different FileSet.
634 \item The Job was a FULL backup.
635 \item The Job terminated normally (i.e. did not fail or was not  canceled).
636 \item The Job started no longer ago than {\bf Max Full Interval}.
637 \end{bsysitemize}
638
639    If all the above conditions do not hold, the Director will  upgrade the
640    Differential to a Full save. Otherwise, the  Differential backup will be
641    performed as requested.
642
643    The File daemon (Client) decides which files to backup for a
644    differential backup by comparing the start time of the prior Full backup
645    Job against the time each file was last ``modified'' (st\_mtime) and the
646    time its attributes were last ``changed'' (st\_ctime).  If the file was
647    modified or its attributes were changed on or after this start time, it
648    will then be backed up.  The start time used is displayed after the {\bf
649    Since} on the Job report.  In rare cases, using the start time of the
650    prior backup may cause some files to be backed up twice, but it ensures
651    that no change is missed.  As with the Incremental option, you should
652    ensure that the clocks on your server and client are synchronized or as
653    close as possible to avoid the possibility of a file being skipped.
654    Note, on versions 1.33 or greater Bacula automatically makes the
655    necessary adjustments to the time between the server and the client so
656    that the times Bacula uses are synchronized.
657
658    When Bacula does a Differential backup, all modified files that are
659    still on the system are backed up.  However, any file that has been
660    deleted since the last Full backup remains in the Bacula catalog, which
661    means that if between a Full save and the time you do a restore, some
662    files are deleted, those deleted files will also be restored.  The
663    deleted files will no longer appear in the catalog after doing another
664    Full save.  However, to remove deleted files from the catalog during a
665    Differential backup is quite a time consuming process and not currently
666    implemented in Bacula.  It is, however, a planned future feature.
667
668    As noted above, if you move a directory rather than copy it, the
669    files in it do not have their modification time (st\_mtime) or
670    their attribute change time (st\_ctime) changed.  As a
671    consequence, those files will probably not be backed up by an
672    Incremental or Differential backup which depend solely on these
673    time stamps.  If you move a directory, and wish it to be
674    properly backed up, it is generally preferable to copy it, then
675    delete the original. Alternatively, you can move the directory, then
676    use the {\bf touch} program to update the timestamps.
677
678 %% TODO: merge this with incremental
679    However, to manage deleted files or directories changes in the
680    catalog during an Differential backup you can use \texttt{accurate}
681    mode. This is quite memory consuming process. See \ilink{Accurate
682      mode}{accuratemode} for more details.
683
684    Every once and a while, someone asks why we need Differential
685    backups as long as Incremental backups pickup all changed files.
686    There are possibly many answers to this question, but the one
687    that is the most important for me is that a Differential backup
688    effectively merges
689    all the Incremental and Differential backups since the last Full backup
690    into a single Differential backup.  This has two effects: 1.  It gives
691    some redundancy since the old backups could be used if the merged backup
692    cannot be read.  2.  More importantly, it reduces the number of Volumes
693    that are needed to do a restore effectively eliminating the need to read
694    all the volumes on which the preceding Incremental and Differential
695    backups since the last Full are done.
696
697 \end{description}
698
699 For a {\bf Restore} Job, no level needs to be specified.
700
701 For a {\bf Verify} Job, the Level may be one of the  following:
702
703 \begin{description}
704
705 \item [InitCatalog]
706 \index[dir]{InitCatalog}
707    does a scan of the specified {\bf FileSet} and stores the file
708    attributes in the Catalog database.  Since no file data is saved, you
709    might ask why you would want to do this.  It turns out to be a very
710    simple and easy way to have a {\bf Tripwire} like feature using {\bf
711    Bacula}.  In other words, it allows you to save the state of a set of
712    files defined by the {\bf FileSet} and later check to see if those files
713    have been modified or deleted and if any new files have been added.
714    This can be used to detect system intrusion.  Typically you would
715    specify a {\bf FileSet} that contains the set of system files that
716    should not change (e.g.  /sbin, /boot, /lib, /bin, \ldots{}).  Normally, you
717    run the {\bf InitCatalog} level verify one time when your system is
718    first setup, and then once again after each modification (upgrade) to
719    your system.  Thereafter, when your want to check the state of your
720    system files, you use a {\bf Verify} {\bf level = Catalog}.  This
721    compares the results of your {\bf InitCatalog} with the current state of
722    the files.
723
724 \item [Catalog]
725 \index[dir]{Catalog}
726    Compares the current state of the files against the state previously
727    saved during an {\bf InitCatalog}.  Any discrepancies are reported.  The
728    items reported are determined by the {\bf verify} options specified on
729    the {\bf Include} directive in the specified {\bf FileSet} (see the {\bf
730    FileSet} resource below for more details).  Typically this command will
731    be run once a day (or night) to check for any changes to your system
732    files.
733
734    Please note!  If you run two Verify Catalog jobs on the same client at
735    the same time, the results will certainly be incorrect.  This is because
736    Verify Catalog modifies the Catalog database while running in order to
737    track new files.
738
739 \item [VolumeToCatalog]
740 \index[dir]{VolumeToCatalog}
741    This level causes Bacula to read the file attribute data written to the
742    Volume from the last backup Job for the job specified on the {\bf VerifyJob}
743    directive.  The file attribute data are compared to the
744    values saved in the Catalog database and any differences are reported.
745    This is similar to the {\bf DiskToCatalog} level except that instead of
746    comparing the disk file attributes to the catalog database, the
747    attribute data written to the Volume is read and compared to the catalog
748    database.  Although the attribute data including the signatures (MD5 or
749    SHA1) are compared, the actual file data is not compared (it is not in
750    the catalog).
751
752    Please note!  If you run two Verify VolumeToCatalog jobs on the same
753    client at the same time, the results will certainly be incorrect.  This
754    is because the Verify VolumeToCatalog modifies the Catalog database
755    while running.
756
757 \item [DiskToCatalog]
758 \index[dir]{DiskToCatalog}
759    This level causes Bacula to read the files as they currently are on
760    disk, and to compare the current file attributes with the attributes
761    saved in the catalog from the last backup for the job specified on the
762    {\bf VerifyJob} directive.  This level differs from the {\bf VolumeToCatalog}
763    level described above by the fact that it doesn't compare against a
764    previous Verify job but against a previous backup.  When you run this
765    level, you must supply the verify options on your Include statements.
766    Those options determine what attribute fields are compared.
767
768    This command can be very useful if you have disk problems because it
769    will compare the current state of your disk against the last successful
770    backup, which may be several jobs.
771
772    Note, the current implementation (1.32c) does not identify files that
773    have been deleted.
774 \end{description}
775
776 \label{Job:Accurate}
777 \item [Accurate = \lt{}yes\vb{}no\gt{}]
778 \index[dir]{Accurate}
779    In accurate mode, the File daemon knowns exactly which files were present
780    after the last backup. So it is able to handle deleted or renamed files.
781
782    When restoring a FileSet for a specified date (including ``most
783    recent''), Bacula is able to restore exactly the files and
784    directories that existed at the time of the last backup prior to
785    that date including ensuring that deleted files are actually deleted,
786    and renamed directories are restored properly.
787
788    In this mode, the File daemon must keep data concerning all files in
789    memory.  So If you do not have sufficient memory, the backup may
790    either be terribly slow or fail.
791
792 %%   $$ memory = \sum_{i=1}^{n}(strlen(path_i + file_i) + sizeof(CurFile))$$
793
794    For 500.000 files (a typical desktop linux system), it will require
795    approximately 64 Megabytes of RAM on your File daemon to hold the
796    required information.
797
798    \label{Job:VerifyJob}
799 \item [Verify Job = \lt{}Job-Resource-Name\gt{}]
800    \index[dir]{Verify Job}
801    \index[dir]{Directive!Verify Job}
802    If you run a verify job without this directive, the last job run will be
803    compared with the catalog, which means that you must immediately follow
804    a backup by a verify command.  If you specify a {\bf Verify Job} Bacula
805    will find the last job with that name that ran.  This permits you to run
806    all your backups, then run Verify jobs on those that you wish to be
807    verified (most often a {\bf VolumeToCatalog}) so that the tape just
808    written is re-read.
809
810 \label{Job:JobDefs}
811 \item [JobDefs = \lt{}JobDefs-Resource-Name\gt{}]
812 \index[dir]{JobDefs}
813 \index[dir]{Directive!JobDefs}
814    If a JobDefs-Resource-Name is specified, all the values contained in the
815    named JobDefs resource will be used as the defaults for the current Job.
816    Any value that you explicitly define in the current Job resource, will
817    override any defaults specified in the JobDefs resource.  The use of
818    this directive permits writing much more compact Job resources where the
819    bulk of the directives are defined in one or more JobDefs.  This is
820    particularly useful if you have many similar Jobs but with minor
821    variations such as different Clients.  A simple example of the use of
822    JobDefs is provided in the default bacula-dir.conf file.
823
824 \label{Job:Bootstrap}
825 \item [Bootstrap = \lt{}bootstrap-file\gt{}]
826 \index[dir]{Bootstrap}
827 \index[dir]{Directive!Bootstrap}
828    The Bootstrap directive specifies a bootstrap file that, if provided,
829    will be used during {\bf Restore} Jobs and is ignored in other Job
830    types.  The {\bf bootstrap} file contains the list of tapes to be used
831    in a restore Job as well as which files are to be restored.
832    Specification of this directive is optional, and if specified, it is
833    used only for a restore job.  In addition, when running a Restore job
834    from the console, this value can be changed.
835
836    If you use the {\bf Restore} command in the Console program, to start a
837    restore job, the {\bf bootstrap} file will be created automatically from
838    the files you select to be restored.
839
840    For additional details of the {\bf bootstrap} file, please see
841    \ilink{Restoring Files with the Bootstrap File}{BootstrapChapter} chapter
842    of this manual.
843 \label{writebootstrap}
844
845 \label{Job:WriteBootstrap}
846 \item [Write Bootstrap =  \lt{}bootstrap-file-specification\gt{}]
847 \index[dir]{Write Bootstrap}
848 \index[dir]{Directive!Write Bootstrap}
849    The {\bf writebootstrap} directive specifies a file name where Bacula
850    will write a {\bf bootstrap} file for each Backup job run.  This
851    directive applies only to Backup Jobs.  If the Backup job is a Full
852    save, Bacula will erase any current contents of the specified file
853    before writing the bootstrap records.  If the Job is an Incremental
854    or Differential
855    save, Bacula will append the current bootstrap record to the end of the
856    file.
857
858    Using this feature, permits you to constantly have a bootstrap file that
859    can recover the current state of your system.  Normally, the file
860    specified should be a mounted drive on another machine, so that if your
861    hard disk is lost, you will immediately have a bootstrap record
862    available.  Alternatively, you should copy the bootstrap file to another
863    machine after it is updated. Note, it is a good idea to write a separate
864    bootstrap file for each Job backed up including the job that backs up
865    your catalog database.
866
867    If the {\bf bootstrap-file-specification} begins with a vertical bar
868    (\verb+|+), Bacula will use the specification as the name of a program to which
869    it will pipe the bootstrap record.  It could for example be a shell
870    script that emails you the bootstrap record.
871
872    On versions 1.39.22 or greater, before opening the file or executing the
873    specified command, Bacula performs
874    \ilink{character substitution}{character substitution} like in RunScript
875    directive. To automatically manage your bootstrap files, you can use
876    this in your {\bf JobDefs} resources:
877 \begin{lstlisting}
878 JobDefs {
879    Write Bootstrap = "%c_%n.bsr"
880    ...
881 }
882 \end{lstlisting}
883
884    For more details on using this file, please see the chapter entitled
885    \ilink{The Bootstrap File}{BootstrapChapter} of this manual.
886
887 \label{Job:Client}
888 \item [Client = \lt{}client-resource-name\gt{}]
889 \index[dir]{Client}
890 \index[dir]{Directive!Client}
891    The Client directive  specifies the Client (File daemon) that will be used in
892    the  current Job. Only a single Client may be specified in any one Job.  The
893    Client runs on the machine to be backed up,  and sends the requested files to
894    the Storage daemon for backup,  or receives them when restoring. For
895    additional details, see the
896    \ilink{Client Resource section}{ClientResource2} of this chapter.
897    This directive is required.
898
899 \label{Job:FileSet}
900 \item [FileSet = \lt{}FileSet-resource-name\gt{}]
901 \index[dir]{FileSet}
902 \index[dir]{Directive!FileSet}
903    The FileSet directive specifies the FileSet that will be used in the
904    current Job.  The FileSet specifies which directories (or files) are to
905    be backed up, and what options to use (e.g.  compression, \ldots{}).  Only a
906    single FileSet resource may be specified in any one Job.  For additional
907    details, see the \ilink{FileSet Resource section}{FileSetResource} of
908    this chapter.  This directive is required.
909
910 \label{Job:Base}
911 \item [Base = \lt{}job-resource-name, \ldots{}\gt{}]
912 \index[dir]{Base}
913 \index[dir]{Directive!Base}
914 The Base directive permits to specify the list of jobs that will be used during
915 Full backup as base. This directive is optional. See the \ilink{Base Job
916 chapter}{basejobs} for more information.
917
918 \label{Job:Messages}
919 \item [Messages = \lt{}messages-resource-name\gt{}]
920 \index[dir]{Messages}
921 \index[dir]{Directive!Messages}
922    The Messages directive defines what Messages resource should be used for
923    this job, and thus how and where the various messages are to be
924    delivered.  For example, you can direct some messages to a log file, and
925    others can be sent by email.  For additional details, see the
926    \ilink{Messages Resource}{MessagesChapter} Chapter of this manual.  This
927    directive is required.
928
929 \label{Job:Pool}
930 \item [Pool = \lt{}pool-resource-name\gt{}]
931 \index[dir]{Pool}
932 \index[dir]{Directive!Pool}
933    The Pool directive defines the pool of Volumes where your data can be
934    backed up.  Many Bacula installations will use only the {\bf Default}
935    pool.  However, if you want to specify a different set of Volumes for
936    different Clients or different Jobs, you will probably want to use
937    Pools.  For additional details, see the \ilink{Pool Resource
938    section}{PoolResource} of this chapter.  This directive is required.
939
940 \label{Job:FullBackupPool}
941 \item [Full Backup Pool = \lt{}pool-resource-name\gt{}]
942 \index[dir]{Full Backup Pool}
943 \index[dir]{Directive!Full Backup Pool}
944    The {\it Full Backup Pool} specifies a Pool to be used for Full backups.
945    It will override any Pool specification during a Full backup.  This
946    directive is optional.
947
948 \label{Job:DifferentialBackupPool}
949 \item [Differential Backup Pool = \lt{}pool-resource-name\gt{}]
950 \index[dir]{Differential Backup Pool}
951 \index[dir]{Directive!Differential Backup Pool}
952    The {\it Differential Backup Pool} specifies a Pool to be used for
953    Differential backups.  It will override any Pool specification during a
954    Differential backup.  This directive is optional.
955
956 \label{Job:IncrementalBackupPool}
957 \item [Incremental Backup Pool = \lt{}pool-resource-name\gt{}]
958 \index[dir]{Incremental Backup Pool}
959 \index[dir]{Directive!Incremental Backup Pool}
960    The {\it Incremental Backup Pool} specifies a Pool to be used for
961    Incremental backups.  It will override any Pool specification during an
962    Incremental backup.  This directive is optional.
963
964 \label{Job:Schedule}
965 \item [Schedule = \lt{}schedule-name\gt{}]
966 \index[dir]{Schedule}
967 \index[dir]{Directive!Schedule}
968    The Schedule directive defines what schedule is to be used for the Job.
969    The schedule in turn determines when the Job will be automatically
970    started and what Job level (i.e.  Full, Incremental, \ldots{}) is to be run.
971    This directive is optional, and if left out, the Job can only be started
972    manually using the Console program.  Although you may specify only a
973    single Schedule resource for any one job, the Schedule resource may
974    contain multiple {\bf Run} directives, which allow you to run the Job at
975    many different times, and each {\bf run} directive permits overriding
976    the default Job Level Pool, Storage, and Messages resources.  This gives
977    considerable flexibility in what can be done with a single Job.  For
978    additional details, see the \ilink{Schedule Resource
979    Chapter}{ScheduleResource} of this manual.
980
981
982 \label{Job:Storage}
983 \item [Storage = \lt{}storage-resource-name\gt{}]
984 \index[dir]{Storage}
985 \index[dir]{Directive!Storage}
986    The Storage directive defines the name of the storage services where you
987    want to backup the FileSet data.  For additional details, see the
988    \ilink{Storage Resource Chapter}{StorageResource2} of this manual.
989    The Storage resource may also be specified in the Job's Pool resource,
990    in which case the value in the Pool resource overrides any value
991    in the Job. This Storage resource definition is not required by either
992    the Job resource or in the Pool, but it must be specified in
993    one or the other, if not an error will result.
994
995 \label{Job:MaxStartDelay}
996 \item [Max Start Delay = \lt{}time\gt{}]
997 \index[dir]{Max Start Delay}
998 \index[dir]{Directive!Max Start Delay}
999    The time specifies the maximum delay between the scheduled time and the
1000    actual start time for the Job.  For example, a job can be scheduled to
1001    run at 1:00am, but because other jobs are running, it may wait to run.
1002    If the delay is set to 3600 (one hour) and the job has not begun to run
1003    by 2:00am, the job will be canceled.  This can be useful, for example,
1004    to prevent jobs from running during day time hours.  The default is 0
1005    which indicates no limit.
1006
1007 \label{Job:MaxRunTime}
1008 \item [Max Run Time = \lt{}time\gt{}]
1009 \index[dir]{Max Run Time}
1010 \index[dir]{Directive!Max Run Time}
1011    The time specifies the maximum allowed time that a job may run, counted
1012    from when the job starts, ({\bf not} necessarily the same as when the
1013    job was scheduled).
1014
1015    By default, the the watchdog thread will kill any Job that has run more
1016    than 6 days.  The maximum watchdog timeout is independent of MaxRunTime
1017    and cannot be changed.
1018
1019
1020 \label{Job:IncrementalWaitRunTime}
1021 \item [Incremental|Differential Max Wait Time = \lt{}time\gt{}]
1022 \index[dir]{Incremental Wait Run Time}
1023 \index[dir]{Differential Wait Run Time}
1024 \index[dir]{Directive!Differential Max Wait Time}
1025     Theses directives have been deprecated in favor of
1026     \texttt{Incremental|Differential Max Run Time} since bacula 2.3.18.
1027
1028 \label{Job:IncrementalMaxRunTime}
1029 \item [Incremental Max Run Time = \lt{}time\gt{}]
1030 \index[dir]{Incremental Max Run Time}
1031 \index[dir]{Directive!Incremental Max Run Time}
1032 The time specifies the maximum allowed time that an Incremental backup job may
1033 run, counted from when the job starts, ({\bf not} necessarily the same as when
1034 the job was scheduled).
1035
1036 \label{Job:DifferentialMaxRunTime}
1037 \item [Differential Max Wait Time = \lt{}time\gt{}]
1038 \index[dir]{Differential Max Run Time}
1039 \index[dir]{Directive!Differential Max Run Time}
1040 The time specifies the maximum allowed time that a Differential backup job may
1041 run, counted from when the job starts, ({\bf not} necessarily the same as when
1042 the job was scheduled).
1043
1044 \label{Job:MaxRunSchedTime}
1045 \item [Max Run Sched Time = \lt{}time\gt{}]
1046 \index[dir]{Max Run Sched Time}
1047 \index[dir]{Directive!Max Run Sched Time}
1048
1049 The time specifies the maximum allowed time that a job may run, counted from
1050 when the job was scheduled. This can be useful to prevent jobs from running
1051 during working hours. We can see it like \texttt{Max Start Delay + Max Run
1052   Time}.
1053
1054 \label{Job:MaxWaitTime}
1055 \item [Max Wait Time = \lt{}time\gt{}]
1056 \index[dir]{Max Wait Time}
1057 \index[dir]{Directive!Max Wait Time}
1058    The time specifies the maximum allowed time that a job may block waiting
1059    for a resource (such as waiting for a tape to be mounted, or waiting for
1060    the storage or file daemons to perform their duties), counted from the
1061    when the job starts, ({\bf not} necessarily the same as when the job was
1062    scheduled). This directive works as expected since bacula 2.3.18.
1063
1064 \begin{figure}[htbp]
1065   \centering
1066   \includegraphics[width=13cm]{\idir different_time}
1067   \label{fig:differenttime}
1068   \caption{Job time control directives}
1069 \end{figure}
1070
1071 \label{Job:MaximumBandwidth}
1072 \item [Maximum Bandwidth = \lt{}speed\gt{}]
1073 \index[dir]{Maximum Bandwidth}
1074 \index[dir]{Directive!Maximum Bandwidth}
1075
1076 The speed parameter specifies the maximum allowed bandwidth that a job may
1077 use. The speed parameter should be specified in k/s, kb/s, m/s or mb/s.
1078
1079 \label{Job:MaxFullInterval}
1080 \item [Max Full Interval = \lt{}time\gt{}]
1081 \index[dir]{Max Full Interval}
1082 \index[dir]{Directive!Max Full Interval}
1083    The time specifies the maximum allowed age (counting from start time) of
1084    the most recent successful Full backup that is required in order to run
1085    Incremental or Differential backup jobs. If the most recent Full backup
1086    is older than this interval, Incremental and Differential backups will be
1087    upgraded to Full backups automatically. If this directive is not present,
1088    or specified as 0, then the age of the previous Full backup is not
1089    considered.
1090 \label{PreferMountedVolumes}
1091
1092 \label{Job:Prefer Mounted Volumes}
1093 \item [Prefer Mounted Volumes = \lt{}yes\vb{}no\gt{}]
1094 \index[dir]{Prefer Mounted Volumes}
1095 \index[dir]{Directive!Prefer Mounted Volumes}
1096    If the Prefer Mounted Volumes directive is set to {\bf yes} (default
1097    yes), the Storage daemon is requested to select either an Autochanger or
1098    a drive with a valid Volume already mounted in preference to a drive
1099    that is not ready.  This means that all jobs will attempt to append
1100    to the same Volume (providing the Volume is appropriate -- right Pool,
1101    \ldots{} for that job), unless you are using multiple pools.
1102    If no drive with a suitable Volume is available, it
1103    will select the first available drive.  Note, any Volume that has
1104    been requested to be mounted, will be considered valid as a mounted
1105    volume by another job.  This if multiple jobs start at the same time
1106    and they all prefer mounted volumes, the first job will request the
1107    mount, and the other jobs will use the same volume.
1108
1109    If the directive is set to {\bf no}, the Storage daemon will prefer
1110    finding an unused drive, otherwise, each job started will append to the
1111    same Volume (assuming the Pool is the same for all jobs).  Setting
1112    Prefer Mounted Volumes to no can be useful for those sites
1113    with multiple drive autochangers that prefer to maximize backup
1114    throughput at the expense of using additional drives and Volumes.
1115    This means that the job will prefer to use an unused drive rather
1116    than use a drive that is already in use.
1117
1118    Despite the above, we recommend against setting this directive to
1119    {\bf no} since
1120    it tends to add a lot of swapping of Volumes between the different
1121    drives and can easily lead to deadlock situations in the Storage
1122    daemon. We will accept bug reports against it, but we cannot guarantee
1123    that we will be able to fix the problem in a reasonable time.
1124
1125    A better alternative for using multiple drives is to use multiple
1126    pools so that Bacula will be forced to mount Volumes from those Pools
1127    on different drives.
1128
1129 \label{Job:PruneJobs}
1130 \item [Prune Jobs = \lt{}yes\vb{}no\gt{}]
1131 \index[dir]{Prune Jobs}
1132 \index[dir]{Directive!Prune Jobs}
1133    Normally, pruning of Jobs from the Catalog is specified on a Client by
1134    Client basis in the Client resource with the {\bf AutoPrune} directive.
1135    If this directive is specified (not normally) and the value is {\bf
1136    yes}, it will override the value specified in the Client resource.  The
1137    default is {\bf no}.
1138
1139
1140 \label{Job:PruneFiles}
1141 \item [Prune Files = \lt{}yes\vb{}no\gt{}]
1142 \index[dir]{Prune Files}
1143 \index[dir]{Directive!Prune Files}
1144    Normally, pruning of Files from the Catalog is specified on a Client by
1145    Client basis in the Client resource with the {\bf AutoPrune} directive.
1146    If this directive is specified (not normally) and the value is {\bf
1147    yes}, it will override the value specified in the Client resource.  The
1148    default is {\bf no}.
1149
1150 \label{Job:PruneVolumes}
1151 \item [Prune Volumes = \lt{}yes\vb{}no\gt{}]
1152 \index[dir]{Prune Volumes}
1153 \index[dir]{Directive!Prune Volumes}
1154    Normally, pruning of Volumes from the Catalog is specified on a Pool by
1155    Pool basis in the Pool resource with the {\bf AutoPrune} directive.
1156    Note, this is different from File and Job pruning which is done on a
1157    Client by Client basis.  If this directive is specified (not normally)
1158    and the value is {\bf yes}, it will override the value specified in the
1159    Pool resource.  The default is {\bf no}.
1160
1161    \label{Job:RunScript}
1162 \item [RunScript \{\lt{}body-of-runscript\gt{}\}]
1163    \index[dir]{RunScript}
1164    \index[dir]{Directive!Run Script}
1165
1166    The RunScript directive behaves like a resource in that it
1167    requires opening and closing braces around a number of directives
1168    that make up the body of the runscript.
1169
1170    The specified {\bf Command} (see below for details) is run as an external
1171    program prior or after the current Job.  This is optional.  By default, the
1172    program is executed on the Client side like in \texttt{ClientRunXXXJob}.
1173
1174    \textbf{Console} options are special commands that are sent to the director instead
1175    of the OS. At this time, console command ouputs are redirected to log with
1176    the jobid 0.
1177
1178    You can use following console command : \texttt{delete}, \texttt{disable},
1179    \texttt{enable}, \texttt{estimate}, \texttt{list}, \texttt{llist},
1180    \texttt{memory}, \texttt{prune}, \texttt{purge}, \texttt{reload},
1181    \texttt{status}, \texttt{setdebug}, \texttt{show}, \texttt{time},
1182    \texttt{trace}, \texttt{update}, \texttt{version}, \texttt{.client},
1183    \texttt{.jobs}, \texttt{.pool}, \texttt{.storage}.  See console chapter for
1184    more information. You need to specify needed information on command line, nothing
1185    will be prompted. Example :
1186
1187 \begin{lstlisting}
1188    Console = "prune files client=%c"
1189    Console = "update stats age=3"
1190 \end{lstlisting}
1191
1192    You can specify more than one Command/Console option per RunScript.
1193
1194    You can use following options may be specified in the body
1195    of the runscript:\\
1196    \LTXtable{0.95\linewidth}{table_runscript}
1197
1198    Any output sent by the command to standard output will be included in the
1199    Bacula job report.  The command string must be a valid program name or name
1200    of a shell script.
1201
1202    In addition, the command string is parsed then fed to the OS,
1203    which means that the path will be searched to execute your specified
1204    command, but there is no shell interpretation, as a consequence, if you
1205    invoke complicated commands or want any shell features such as redirection
1206    or piping, you must call a shell script and do it inside that script.
1207
1208    Before submitting the specified command to the operating system, Bacula
1209    performs character substitution of the following characters:
1210 \label{character substitution}
1211
1212 \footnotesize
1213 \begin{lstlisting}
1214     %% = %
1215     %b = Job Bytes
1216     %c = Client's name
1217     %d = Daemon's name (Such as host-dir or host-fd)
1218     %D = Director's name (Also valid on file daemon)
1219     %e = Job Exit Status
1220     %f = Job FileSet (Only on director side)
1221     %F = Job Files
1222     %h = Client address
1223     %i = JobId
1224     %j = Unique Job id
1225     %l = Job Level
1226     %n = Job name
1227     %p = Pool name (Only on director side)
1228     %s = Since time
1229     %t = Job type (Backup, ...)
1230     %v = Volume name (Only on director side)
1231     %w = Storage name (Only on director side)
1232     %x = Spooling enabled? ("yes" or "no")
1233
1234 \end{lstlisting}
1235 \normalsize
1236
1237 Some character substitutions are not available in all situations. The Job Exit
1238 Status code \%e edits the following values:
1239
1240
1241 \index[dir]{Exit Status}
1242 \begin{bsysitemize}
1243 \item OK
1244 \item Error
1245 \item Fatal Error
1246 \item Canceled
1247 \item Differences
1248 \item Unknown term code
1249 \end{bsysitemize}
1250
1251    Thus if you edit it on a command line, you will need to enclose
1252    it within some sort of quotes.
1253
1254
1255 You can use these following shortcuts:\\
1256
1257 \LTXtable{0.95\linewidth}{table_runscriptshortcuts}
1258 Examples:
1259 \begin{lstlisting}
1260 RunScript {
1261     RunsWhen = Before
1262     FailJobOnError = No
1263     Command = "/etc/init.d/apache stop"
1264 }
1265
1266 RunScript {
1267     RunsWhen = After
1268     RunsOnFailure = yes
1269     Command = "/etc/init.d/apache start"
1270 }
1271 \end{lstlisting}
1272
1273    {\bf Notes about ClientRunBeforeJob}
1274
1275    For compatibility reasons, with this shortcut, the command is executed
1276    directly when the client recieve it. And if the command is in error, other
1277    remote runscripts will be discarded. To be sure that all commands will be
1278    sent and executed, you have to use RunScript syntax.
1279
1280    {\bf Special Windows Considerations}
1281
1282    You can run scripts just after snapshots initializations with
1283    \textsl{AfterVSS} keyword.
1284
1285    In addition, for a Windows client, please take
1286    note that you must ensure a correct path to your script.  The script or
1287    program can be a .com, .exe or a .bat file.  If you just put the program
1288    name in then Bacula will search using the same rules that cmd.exe uses
1289    (current directory, Bacula bin directory, and PATH).  It will even try the
1290    different extensions in the same order as cmd.exe.
1291    The command can be anything that cmd.exe or command.com will recognize
1292    as an executable file.
1293
1294    However, if you have slashes in the program name then Bacula figures you
1295    are fully specifying the name, so you must also explicitly add the three
1296    character extension.
1297
1298    The command is run in a Win32 environment, so Unix like commands will not
1299    work unless you have installed and properly configured Cygwin in addition
1300    to and separately from Bacula.
1301
1302    The System \%Path\% will be searched for the command.  (under the
1303    environment variable dialog you have have both System Environment and
1304    User Environment, we believe that only the System environment will be
1305    available to bacula-fd, if it is running as a service.)
1306
1307    System environment variables can be referenced with \%var\% and
1308    used as either part of the command name or arguments.
1309
1310    So if you have a script in the Bacula\\bin directory then the following lines
1311    should work fine:
1312
1313 \footnotesize
1314 \begin{lstlisting}
1315         Client Run Before Job = systemstate
1316 or
1317         Client Run Before Job = systemstate.bat
1318 or
1319         Client Run Before Job = "systemstate"
1320 or
1321         Client Run Before Job = "systemstate.bat"
1322 or
1323         ClientRunBeforeJob = "\"C:/Program Files/Bacula/systemstate.bat\""
1324 \end{lstlisting}
1325 \normalsize
1326
1327 The outer set of quotes is removed when the configuration file is parsed.
1328 You need to escape the inner quotes so that they are there when the code
1329 that parses the command line for execution runs so it can tell what the
1330 program name is.
1331
1332
1333 \footnotesize
1334 \begin{lstlisting}
1335 ClientRunBeforeJob = "\"C:/Program Files/Software
1336      Vendor/Executable\" /arg1 /arg2 \"foo bar\""
1337 \end{lstlisting}
1338 \normalsize
1339
1340    The special characters
1341 \begin{lstlisting}
1342 &<>()@^|
1343 \end{lstlisting}
1344    will need to be quoted,
1345    if they are part of a filename or argument.
1346
1347    If someone is logged in, a blank ``command'' window running the commands
1348    will be present during the execution of the command.
1349
1350    Some Suggestions from Phil Stracchino for running on Win32 machines with
1351    the native Win32 File daemon:
1352
1353    \begin{enumerate}
1354    \item You might want the ClientRunBeforeJob directive to specify a .bat
1355       file which runs the actual client-side commands, rather than trying
1356       to run (for example) regedit /e directly.
1357    \item The batch file should explicitly 'exit 0' on successful completion.
1358    \item The path to the batch file should be specified in Unix form:
1359
1360       ClientRunBeforeJob = "c:/bacula/bin/systemstate.bat"
1361
1362    rather than DOS/Windows form:
1363
1364    ClientRunBeforeJob =
1365
1366 "c:\textbackslash{}bacula\textbackslash{}bin\textbackslash{}systemstate.bat"
1367    INCORRECT
1368    \end{enumerate}
1369
1370 For Win32, please note that there are certain limitations:
1371
1372 ClientRunBeforeJob = "C:/Program Files/Bacula/bin/pre-exec.bat"
1373
1374 Lines like the above do not work because there are limitations of
1375 cmd.exe that is used to execute the command.
1376 Bacula prefixes the string you supply with {\bf cmd.exe /c }.  To test that
1377 your command works you should type {\bf cmd /c "C:/Program Files/test.exe"} at a
1378 cmd prompt and see what happens.  Once the command is correct insert a
1379 backslash (\textbackslash{}) before each double quote ("), and
1380 then put quotes around the whole thing when putting it in
1381 the director's .conf file.  You either need to have only one set of quotes
1382 or else use the short name and don't put quotes around the command path.
1383
1384 Below is the output from cmd's help as it relates to the command line
1385 passed to the /c option.
1386
1387
1388  If /C or /K is specified, then the remainder of the command line after
1389  the switch is processed as a command line, where the following logic is
1390  used to process quote (") characters:
1391
1392 \begin{enumerate}
1393 \item
1394      If all of the following conditions are met, then quote characters
1395          on the command line are preserved:
1396     \begin{bsysitemize}
1397        \item no /S switch.
1398        \item exactly two quote characters.
1399        \item no special characters between the two quote characters,
1400            where special is one of:
1401 \begin{lstlisting}
1402 &<>()@^|
1403 \end{lstlisting}
1404        \item there are one or more whitespace characters between the
1405            the two quote characters.
1406        \item the string between the two quote characters is the name
1407            of an executable file.
1408     \end{bsysitemize}
1409
1410 \item  Otherwise, old behavior is to see if the first character is
1411          a quote character and if so, strip the leading character and
1412          remove the last quote character on the command line, preserving
1413          any text after the last quote character.
1414
1415 \end{enumerate}
1416
1417
1418 The following example of the use of the Client Run Before Job directive was
1419 submitted by a user:\\
1420 You could write a shell script to back up a DB2 database to a FIFO. The shell
1421 script is:
1422
1423 \footnotesize
1424 \begin{lstlisting}
1425  #!/bin/sh
1426  # ===== backupdb.sh
1427  DIR=/u01/mercuryd
1428
1429  mkfifo $DIR/dbpipe
1430  db2 BACKUP DATABASE mercuryd TO $DIR/dbpipe WITHOUT PROMPTING &
1431  sleep 1
1432 \end{lstlisting}
1433 \normalsize
1434
1435 The following line in the Job resource in the bacula-dir.conf file:
1436 \footnotesize
1437 \begin{lstlisting}
1438  Client Run Before Job = "su - mercuryd -c \"/u01/mercuryd/backupdb.sh '%t'
1439 '%l'\""
1440 \end{lstlisting}
1441 \normalsize
1442
1443 When the job is run, you will get messages from the output of the script
1444 stating that the backup has started. Even though the command being run is
1445 backgrounded with \&, the job will block until the ``db2 BACKUP DATABASE''
1446 command, thus the backup stalls.
1447
1448 To remedy this situation, the ``db2 BACKUP DATABASE'' line should be changed to
1449 the following:
1450
1451 \footnotesize
1452 \begin{lstlisting}
1453  db2 BACKUP DATABASE mercuryd TO $DIR/dbpipe WITHOUT PROMPTING > $DIR/backup.log
1454 2>&1 < /dev/null &
1455 \end{lstlisting}
1456 \normalsize
1457
1458 It is important to redirect the input and outputs of a backgrounded command to
1459 /dev/null to prevent the script from blocking.
1460
1461 \label{Job:RunBeforeJob}
1462 \item [Run Before Job = \lt{}command\gt{}]
1463 \index[dir]{Run Before Job}
1464 \index[dir]{Directive!Run Before Job}
1465 \index[dir]{Directive!Run Before Job}
1466 The specified {\bf command} is run as an external program prior to running the
1467 current Job.  This directive is not required, but if it is defined, and if the
1468 exit code of the program run is non-zero, the current Bacula job will be
1469 canceled.
1470
1471 \begin{lstlisting}
1472 Run Before Job = "echo test"
1473 \end{lstlisting}
1474    it's equivalent to :
1475 \begin{lstlisting}
1476 RunScript {
1477  Command = "echo test"
1478  RunsOnClient = No
1479  RunsWhen = Before
1480 }
1481 \end{lstlisting}
1482
1483    Lutz Kittler has pointed out that using the RunBeforeJob directive can be a
1484    simple way to modify your schedules during a holiday.  For example, suppose
1485    that you normally do Full backups on Fridays, but Thursday and Friday are
1486    holidays.  To avoid having to change tapes between Thursday and Friday when
1487    no one is in the office, you can create a RunBeforeJob that returns a
1488    non-zero status on Thursday and zero on all other days.  That way, the
1489    Thursday job will not run, and on Friday the tape you inserted on Wednesday
1490    before leaving will be used.
1491
1492 \label{Job:RunAfterJob}
1493 \item [Run After Job = \lt{}command\gt{}]
1494 \index[dir]{Run After Job}
1495 \index[dir]{Directive!Run After Job}
1496    The specified {\bf command} is run as an external program if the current
1497    job terminates normally (without error or without being canceled).  This
1498    directive is not required.  If the exit code of the program run is
1499    non-zero, Bacula will print a warning message.  Before submitting the
1500    specified command to the operating system, Bacula performs character
1501    substitution as described above for the {\bf RunScript} directive.
1502
1503    An example of the use of this directive is given in the
1504    \bsysxrlink{Tips}{JobNotification}{problems}{chapter} of the \problemsman{}.
1505
1506    See the {\bf Run After Failed Job} if you
1507    want to run a script after the job has terminated with any
1508    non-normal status.
1509
1510 \label{Job:RunAfterJob}
1511 \item [Run After Failed Job = \lt{}command\gt{}]
1512 \index[dir]{Run After Job}
1513 \index[dir]{Directive!Run After Job}
1514    The specified {\bf command} is run as an external program after the current
1515    job terminates with any error status.  This directive is not required.  The
1516    command string must be a valid program name or name of a shell script. If
1517    the exit code of the program run is non-zero, Bacula will print a
1518    warning message. Before submitting the specified command to the
1519    operating system, Bacula performs character substitution as described above
1520    for the {\bf RunScript} directive. Note, if you wish that your script
1521    will run regardless of the exit status of the Job, you can use this :
1522 \begin{lstlisting}
1523 RunScript {
1524  Command = "echo test"
1525  RunsWhen = After
1526  RunsOnFailure = yes
1527  RunsOnClient  = no
1528  RunsOnSuccess = yes    # default, you can drop this line
1529 }
1530 \end{lstlisting}
1531
1532    An example of the use of this directive is given in the
1533    \bsysxrlink{Tips}{JobNotification}{problems}{chapter} of the \problemsman{}.
1534
1535
1536 \label{Job:ClientRunBeforeJob}
1537 \item [Client Run Before Job = \lt{}command\gt{}]
1538 \index[dir]{Client Run Before Job}
1539 \index[dir]{Directive!Client Run Before Job}
1540    This directive is the same as {\bf Run Before Job} except that the
1541    program is run on the client machine.  The same restrictions apply to
1542    Unix systems as noted above for the {\bf RunScript}.
1543
1544    \label{Job:ClientRunAfterJob}
1545 \item [Client Run After Job = \lt{}command\gt{}]
1546    \index[dir]{Client Run After Job}
1547    \index[dir]{Directive!Client Run After Job}
1548    The specified {\bf command} is run on the client machine as soon
1549    as data spooling is complete in order to allow restarting applications
1550    on the client as soon as possible. .
1551
1552    Note, please see the notes above in {\bf RunScript}
1553    concerning Windows clients.
1554
1555    \label{Job:RerunFailedLevels}
1556 \item [Rerun Failed Levels = \lt{}yes\vb{}no\gt{}]
1557    \index[dir]{Rerun Failed Levels}
1558    \index[dir]{Directive!Rerun Failed Levels}
1559    If this directive is set to {\bf yes} (default no), and Bacula detects that
1560    a previous job at a higher level (i.e.  Full or Differential) has failed,
1561    the current job level will be upgraded to the higher level.  This is
1562    particularly useful for Laptops where they may often be unreachable, and if
1563    a prior Full save has failed, you wish the very next backup to be a Full
1564    save rather than whatever level it is started as.
1565
1566    There are several points that must be taken into account when using this
1567    directive: first, a failed job is defined as one that has not terminated
1568    normally, which includes any running job of the same name (you need to
1569    ensure that two jobs of the same name do not run simultaneously);
1570    secondly, the {\bf Ignore FileSet Changes} directive is not considered
1571    when checking for failed levels, which means that any FileSet change will
1572    trigger a rerun.
1573
1574    \label{Job:SpoolData}
1575 \item [Spool Data = \lt{}yes\vb{}no\gt{}]
1576    \index[dir]{Spool Data}
1577    \index[dir]{Directive!Spool Data}
1578
1579    If this directive is set  to {\bf yes} (default no), the Storage daemon will
1580    be requested  to spool the data for this Job to disk rather than write it
1581    directly to the Volume (normally a tape).
1582
1583    Thus the data is written in large blocks to the Volume rather than small
1584    blocks.  This directive is particularly useful when running multiple
1585    simultaneous backups to tape.  Once all the data arrives or the spool
1586    files' maximum sizes are reached, the data will be despooled and written
1587    to tape.
1588
1589    Spooling data prevents interleaving date from several job and reduces or
1590    eliminates tape drive stop and start commonly known as ``shoe-shine''.
1591
1592    We don't recommend using this option if you are writing to a disk file
1593    using this option will probably just slow down the backup jobs.
1594
1595    NOTE: When this directive is set to yes, Spool Attributes is also
1596    automatically set to yes.
1597
1598    \label{Job:SpoolData}
1599 \item [SpoolData=yes\vb{}no]
1600    \index[dir]{SpoolData}
1601    \index[dir]{Directive!SpoolData}
1602    tells Bacula to request the Storage  daemon to spool data to a disk file
1603    before writing it to the Volume (normally a tape).
1604
1605    \label{Job:SpoolAttributes}
1606 \item [Spool Attributes = \lt{}yes\vb{}no\gt{}]
1607    \index[dir]{Spool Attributes}
1608    \index[dir]{Directive!Spool Attributes}
1609    \index[dir]{slow}
1610    \index[general]{slow}
1611    \index[dir]{Backups!slow}
1612    \index[general]{Backups!slow}
1613    The default is set to {\bf no}, which means that the File attributes are
1614    sent by the Storage daemon to the Director as they are stored on tape.
1615    However, if you want to avoid the possibility that database updates will
1616    slow down writing to the tape, you may want to set the value to {\bf
1617    yes}, in which case the Storage daemon will buffer the File attributes
1618    and Storage coordinates to a temporary file in the Working Directory,
1619    then when writing the Job data to the tape is completed, the attributes
1620    and storage coordinates will be sent to the Director.
1621
1622    NOTE: When Spool Data is set to yes, Spool Attributes is also
1623    automatically set to yes.
1624
1625    \label{Job:SpoolSize}
1626 \item [SpoolSize={\it bytes}]
1627    \index[dir]{SpoolSize}
1628    \index[dir]{Directive!SpoolSize}
1629    where the bytes specify the maximum spool size for this job.
1630    The default is take from Device Maximum Spool Size limit.
1631    This directive is available only in Bacula version 2.3.5 or
1632    later.
1633
1634
1635    \label{Job:Where}
1636 \item [Where = \lt{}directory\gt{}]
1637    \index[dir]{Where}
1638    \index[dir]{Directive!Where}
1639    This directive applies only to a Restore job and specifies a prefix to
1640    the directory name of all files being restored.  This permits files to
1641    be restored in a different location from which they were saved.  If {\bf
1642    Where} is not specified or is set to backslash ({\bf /}), the files will
1643    be restored to their original location.  By default, we have set {\bf
1644    Where} in the example configuration files to be {\bf
1645    /tmp/bacula-restores}.  This is to prevent accidental overwriting of
1646    your files.
1647
1648   \label{confaddprefix}
1649   \label{Job:AddPrefix}
1650 \item [Add Prefix = \lt{}directory\gt{}]
1651   \index[dir]{AddPrefix}
1652   \index[dir]{Directive!AddPrefix}
1653   This directive applies only to a Restore job and specifies a prefix to the
1654   directory name of all files being restored.  This will use \ilink{File
1655   Relocation}{filerelocation} feature implemented in Bacula 2.1.8 or later.
1656
1657   \label{Job:AddSuffix}
1658 \item [Add Suffix = \lt{}extention\gt{}]
1659   \index[dir]{AddSuffix}
1660   \index[dir]{Directive!AddSuffix}
1661   This directive applies only to a Restore job and specifies a suffix to all
1662   files being restored.  This will use \ilink{File Relocation}{filerelocation}
1663   feature implemented in Bacula 2.1.8 or later.
1664
1665   Using \texttt{Add Suffix=.old}, \texttt{/etc/passwd} will be restored to
1666   \texttt{/etc/passwsd.old}
1667
1668   \label{Job:StripPrefix}
1669 \item [Strip Prefix = \lt{}directory\gt{}]
1670   \index[dir]{StripPrefix}
1671   \index[dir]{Directive!StripPrefix}
1672   This directive applies only to a Restore job and specifies a prefix to remove
1673   from the directory name of all files being restored.  This will use the
1674   \ilink{File Relocation}{filerelocation} feature implemented in Bacula 2.1.8
1675   or later.
1676
1677   Using \texttt{Strip Prefix=/etc}, \texttt{/etc/passwd} will be restored to
1678   \texttt{/passwd}
1679
1680   Under Windows, if you want to restore \texttt{c:/files} to \texttt{d:/files},
1681   you can use :
1682
1683 \begin{lstlisting}
1684  Strip Prefix = c:
1685  Add Prefix = d:
1686 \end{lstlisting}
1687
1688   \label{Job:RegexWhere}
1689 \item [RegexWhere = \lt{}expressions\gt{}]
1690   \index[dir]{RegexWhere}
1691   \index[dir]{Directive!RegexWhere}
1692   This directive applies only to a Restore job and specifies a regex filename
1693   manipulation of all files being restored.  This will use \ilink{File
1694   Relocation}{filerelocation} feature implemented in Bacula 2.1.8 or later.
1695
1696   For more informations about how use this option, see
1697   \ilink{this}{useregexwhere}.
1698
1699    \label{Job:Replace}
1700 \item [Replace = \lt{}replace-option\gt{}]
1701    \index[dir]{Replace}
1702    \index[dir]{Directive!Replace}
1703    This directive applies only to a Restore job and specifies what happens
1704    when Bacula wants to restore a file or directory that already exists.
1705    You have the following options for {\bf replace-option}:
1706
1707 \begin{description}
1708
1709 \item [always]
1710    \index[dir]{always}
1711   when the file to be restored already exists, it is deleted and then
1712   replaced by the copy that was backed up.  This is the default value.
1713
1714 \item [ifnewer]
1715 \index[dir]{ifnewer}
1716   if the backed up file (on tape) is newer than the existing file, the
1717   existing file is deleted and replaced by the back up.
1718
1719 \item [ifolder]
1720    \index[dir]{ifolder}
1721   if the backed up file (on tape) is older than the existing file, the
1722   existing file is deleted and replaced by the back up.
1723
1724 \item [never]
1725    \index[dir]{never}
1726   if the backed up file already exists, Bacula skips  restoring this file.
1727 \end{description}
1728
1729    \label{Job:PrefixLinks}
1730 \item [Prefix Links=\lt{}yes\vb{}no\gt{}]
1731    \index[dir]{Prefix Links}
1732    \index[dir]{Directive!Prefix Links}
1733    If a {\bf Where} path prefix is specified for a recovery job, apply it
1734    to absolute links as well.  The default is {\bf No}.  When set to {\bf
1735    Yes} then while restoring files to an alternate directory, any absolute
1736    soft links will also be modified to point to the new alternate
1737    directory.  Normally this is what is desired -- i.e.  everything is self
1738    consistent.  However, if you wish to later move the files to their
1739    original locations, all files linked with absolute names will be broken.
1740
1741    \label{Job:MaximumConcurrentJobs}
1742 \item [Maximum Concurrent Jobs = \lt{}number\gt{}]
1743    \index[dir]{Maximum Concurrent Jobs}
1744    \index[dir]{Directive!Maximum Concurrent Jobs}
1745    where \lt{}number\gt{} is the maximum number of Jobs from the current
1746    Job resource that can run concurrently.  Note, this directive limits
1747    only Jobs with the same name as the resource in which it appears.  Any
1748    other restrictions on the maximum concurrent jobs such as in the
1749    Director, Client, or Storage resources will also apply in addition to
1750    the limit specified here.  The default is set to 1, but you may set it
1751    to a larger number.  We strongly recommend that you read the WARNING
1752    documented under \ilink{ Maximum Concurrent Jobs}{DirMaxConJobs} in the
1753    Director's resource.
1754
1755    \label{Job:RescheduleOnError}
1756 \item [Reschedule On Error = \lt{}yes\vb{}no\gt{}]
1757    \index[dir]{Reschedule On Error}
1758    \index[dir]{Directive!Reschedule On Error}
1759    If this directive is enabled, and the job terminates in error, the job
1760    will be rescheduled as determined by the {\bf Reschedule Interval} and
1761    {\bf Reschedule Times} directives.  If you cancel the job, it will not
1762    be rescheduled.  The default is {\bf no} (i.e.  the job will not be
1763    rescheduled).
1764
1765    This specification can be useful for portables, laptops, or other
1766    machines that are not always connected to the network or switched on.
1767
1768    \label{Job:RescheduleInterval}
1769 \item [Reschedule Interval = \lt{}time-specification\gt{}]
1770    \index[dir]{Reschedule Interval}
1771    \index[dir]{Directive!Reschedule Interval}
1772    If you have specified {\bf Reschedule On Error = yes} and the job
1773    terminates in error, it will be rescheduled after the interval of time
1774    specified by {\bf time-specification}.  See \ilink{the time
1775    specification formats}{Time} in the Configure chapter for details of
1776    time specifications.  If no interval is specified, the job will not be
1777    rescheduled on error.
1778
1779    \label{Job:RescheduleTimes}
1780 \item [Reschedule Times = \lt{}count\gt{}]
1781    \index[dir]{Reschedule Times}
1782    \index[dir]{Directive!Reschedule Times}
1783    This directive specifies the maximum number of times to reschedule the
1784    job.  If it is set to zero (the default) the job will be rescheduled an
1785    indefinite number of times.
1786
1787 \label{Job:AllowDuplicateJobs}
1788 \item [Allow Duplicate Jobs = \lt{}yes\vb{}no\gt{}]
1789 \index[general]{Allow Duplicate Jobs}
1790
1791 %\begin{figure}[htbp]
1792 %  \centering
1793 %  \includegraphics[width=13cm]{\idir duplicate-real}
1794 %  \label{fig:allowduplicatejobs}
1795 %  \caption{Allow Duplicate Jobs usage}
1796 %\end{figure}
1797 \bsysimageH{duplicate-real}{Allow Duplicate Jobs usage}{fig:allowduplicatejobs}
1798
1799 A duplicate job in the sense we use it here means a second or subsequent job
1800 with the same name starts.  This happens most frequently when the first job
1801 runs longer than expected because no tapes are available.
1802
1803   If this directive is enabled duplicate jobs will be run.  If
1804   the directive is set to {\bf no} (default) then only one job of a given name
1805   may run at one time, and the action that Bacula takes to ensure only
1806   one job runs is determined by the other directives (see below).
1807
1808   If {\bf Allow Duplicate Jobs} is set to {\bf no} and two jobs
1809   are present and none of the three directives given below permit
1810   cancelling a job, then the current job (the second one started)
1811   will be cancelled.
1812
1813 \label{Job:AllowHigherDuplicates}
1814 \item [Allow Higher Duplicates = \lt{}yes\vb{}no\gt{}]
1815 \index[general]{Allow Higher Duplicates}
1816   This directive was implemented in version 5.0.0, but does not work
1817   as expected. If used, it should always be set to no.  In later versions
1818   of Bacula the directive is disabled (disregarded).
1819
1820
1821 \label{Job:CancelLowerLevelDuplicates}
1822 \item [Cancel Lower Level Duplicates = \lt{}yes\vb{}no\gt{}]
1823 \index[general]{Cancel Lower Level Duplicates}
1824   If \textbf{Allow Duplicates Jobs} is set to \textbf{no} and this
1825   directive is set to \textbf{yes}, Bacula will choose between duplicated
1826   jobs the one with the highest level.  For example, it will cancel a
1827   previous Incremental to run a Full backup.  It works only for Backup
1828   jobs.  The default is \texttt{no}. If the levels of the duplicated
1829   jobs are the same, nothing is done and the other
1830   Cancel XXX Duplicate directives will be examined.
1831
1832 \label{Job:CancelQueuedDuplicates}
1833 \item [Cancel Queued Duplicates = \lt{}yes\vb{}no\gt{}]
1834 \index[general]{Cancel Queued Duplicates}
1835   If {\bf Allow Duplicate Jobs} is set to {\bf no} and
1836   if this directive is set to {\bf yes} any job that is
1837   already queued to run but not yet running will be canceled.
1838   The default is {\bf no}.
1839
1840 \label{Job:CancelRunningDuplicates}
1841 \item[Cancel Running Duplicates = \lt{}yes\vb{}no\gt{}]
1842 \index[general]{Cancel Running Duplicates}
1843   If {\bf Allow Duplicate Jobs} is set to {\bf no} and
1844   if this directive is set to {\bf yes} any job that is already running
1845   will be canceled.  The default is {\bf no}.
1846
1847
1848 %%\item[DuplicateJobProximity = \lt{}time-specification\gt{}]
1849 %%\index[general]{Duplicate Job Proximity}
1850 %%  This directive permits to determine if two jobs are really duplicated.
1851 %%  If the first one is running for long time, this is probably not a good
1852 %%  idea to cancel it.
1853
1854    \label{Job:Run}
1855 \item [Run = \lt{}job-name\gt{}]
1856    \index[dir]{Run}
1857    \index[dir]{Directive!Run}
1858    \index[dir]{Clone a Job}
1859    The Run directive (not to be confused with the Run option in a
1860    Schedule) allows you to start other jobs or to clone jobs. By using the
1861    cloning keywords (see below), you can backup
1862    the same data (or almost the same data) to two or more drives
1863    at the same time. The {\bf job-name} is normally the same name
1864    as the current Job resource (thus creating a clone). However, it
1865    may be any Job name, so one job may start other related jobs.
1866
1867    The part after the equal sign must be enclosed in double quotes,
1868    and can contain any string or set of options (overrides) that you
1869    can specify when entering the Run command from the console. For
1870    example {\bf storage=DDS-4 \ldots{}}.  In addition, there are two special
1871    keywords that permit you to clone the current job. They are {\bf level=\%l}
1872    and {\bf since=\%s}. The \%l in the level keyword permits
1873    entering the actual level of the current job and the \%s in the since
1874    keyword permits putting the same time for comparison as used on the
1875    current job.  Note, in the case of the since keyword, the \%s must be
1876    enclosed in double quotes, and thus they must be preceded by a backslash
1877    since they are already inside quotes. For example:
1878
1879 \begin{lstlisting}
1880    run = "Nightly-backup level=%l since=\"%s\" storage=DDS-4"
1881 \end{lstlisting}
1882
1883    A cloned job will not start additional clones, so it is not
1884    possible to recurse.
1885
1886    Please note that all cloned jobs, as specified in the Run directives are
1887    submitted for running before the original job is run (while it is being
1888    initialized). This means that any clone job will actually start before
1889    the original job, and may even block the original job from starting
1890    until the original job finishes unless you allow multiple simultaneous
1891    jobs.  Even if you set a lower priority on the clone job, if no other
1892    jobs are running, it will start before the original job.
1893
1894    If you are trying to prioritize jobs by using the clone feature (Run
1895    directive), you will find it much easier to do using a RunScript
1896    resource, or a RunBeforeJob directive.
1897 \label{Priority}
1898
1899    \label{Job:Priority}
1900 \item [Priority = \lt{}number\gt{}]
1901    \index[dir]{Priority}
1902    \index[dir]{Directive!Priority}
1903    This directive permits you to control the order in which your jobs will
1904    be run by specifying a positive non-zero number. The higher the number,
1905    the lower the job priority. Assuming you are not running concurrent jobs,
1906    all queued jobs of priority 1 will run before queued jobs of priority 2
1907    and so on, regardless of the original scheduling order.
1908
1909    The priority only affects waiting jobs that are queued to run, not jobs
1910    that are already running.  If one or more jobs of priority 2 are already
1911    running, and a new job is scheduled with priority 1, the currently
1912    running priority 2 jobs must complete before the priority 1 job is
1913    run, unless Allow Mixed Priority is set.
1914
1915    The default priority is 10.
1916
1917    If you want to run concurrent jobs you should
1918    keep these points in mind:
1919
1920 \begin{bsysitemize}
1921 \item See \bsysxrlink{Running Concurrent Jobs}{ConcurrentJobs}{problems}{section} on how to setup
1922    concurrent jobs in the \problemsman{}.
1923
1924 \item Bacula concurrently runs jobs of only one priority at a time.  It
1925    will not simultaneously run a priority 1 and a priority 2 job.
1926
1927 \item If Bacula is running a priority 2 job and a new priority 1 job is
1928    scheduled, it will wait until the running priority 2 job terminates even
1929    if the Maximum Concurrent Jobs settings would otherwise allow two jobs
1930    to run simultaneously.
1931
1932 \item Suppose that bacula is running a priority 2 job and a new priority 1
1933    job is scheduled and queued waiting for the running priority 2 job to
1934    terminate.  If you then start a second priority 2 job, the waiting
1935    priority 1 job will prevent the new priority 2 job from running
1936    concurrently with the running priority 2 job.  That is: as long as there
1937    is a higher priority job waiting to run, no new lower priority jobs will
1938    start even if the Maximum Concurrent Jobs settings would normally allow
1939    them to run.  This ensures that higher priority jobs will be run as soon
1940    as possible.
1941 \end{bsysitemize}
1942
1943 If you have several jobs of different priority, it may not best to start
1944 them at exactly the same time, because Bacula must examine them one at a
1945 time.  If by Bacula starts a lower priority job first, then it will run
1946 before your high priority jobs.  If you experience this problem, you may
1947 avoid it by starting any higher priority jobs a few seconds before lower
1948 priority ones.  This insures that Bacula will examine the jobs in the
1949 correct order, and that your priority scheme will be respected.
1950 \label{AllowMixedPriority}
1951
1952 \label{Job:AllowMixedPriority}
1953 \item [Allow Mixed Priority = \lt{}yes\vb{}no\gt{}]
1954 \index[dir]{Allow Mixed Priority}
1955    This directive is only implemented in version 2.5 and later.  When
1956    set to {\bf yes} (default {\bf no}), this job may run even if lower
1957    priority jobs are already running.  This means a high priority job
1958    will not have to wait for other jobs to finish before starting.
1959    The scheduler will only mix priorities when all running jobs have
1960    this set to true.
1961
1962    Note that only higher priority jobs will start early.  Suppose the
1963    director will allow two concurrent jobs, and that two jobs with
1964    priority 10 are running, with two more in the queue.  If a job with
1965    priority 5 is added to the queue, it will be run as soon as one of
1966    the running jobs finishes.  However, new priority 10 jobs will not
1967    be run until the priority 5 job has finished.
1968 \label{WritePartAfterJob}
1969
1970 \label{Job:WritePartAfterJob}
1971 \item [Write Part After Job = \lt{}yes\vb{}no\gt{}]
1972 \index[dir]{Write Part After Job}
1973 \index[dir]{Directive!Write Part After Job}
1974    This directive is only implemented in version 1.37 and later.
1975    If this directive is set to {\bf yes} (default {\bf no}), a new part file
1976    will be created after the job is finished.
1977
1978    It should be set to {\bf yes} when writing to devices that require mount
1979    (for example DVD), so you are sure that the current part, containing
1980    this job's data, is written to the device, and that no data is left in
1981    the temporary file on the hard disk.  However, on some media, like DVD+R
1982    and DVD-R, a lot of space (about 10Mb) is lost every time a part is
1983    written.  So, if you run several jobs each after another, you could set
1984    this directive to {\bf no} for all jobs, except the last one, to avoid
1985    wasting too much space, but to ensure that the data is written to the
1986    medium when all jobs are finished.
1987
1988    This directive is ignored with tape and FIFO devices.
1989
1990 \end{description}
1991
1992 The following is an example of a valid Job resource definition:
1993
1994 \footnotesize
1995 \begin{lstlisting}
1996 Job {
1997   Name = "Minou"
1998   Type = Backup
1999   Level = Incremental                 # default
2000   Client = Minou
2001   FileSet="Minou Full Set"
2002   Storage = DLTDrive
2003   Pool = Default
2004   Schedule = "MinouWeeklyCycle"
2005   Messages = Standard
2006 }
2007 \end{lstlisting}
2008 \normalsize
2009
2010 \label{JobDefsResource}
2011 \section{The JobDefs Resource}
2012 \index[general]{JobDefs Resource}
2013 \index[general]{Resource!JobDefs}
2014
2015 The JobDefs resource permits all the same directives that can appear in a Job
2016 resource. However, a JobDefs resource does not create a Job, rather it can be
2017 referenced within a Job to provide defaults for that Job. This permits you to
2018 concisely define several nearly identical Jobs, each one referencing a JobDefs
2019 resource which contains the defaults. Only the changes from the defaults need to
2020 be mentioned in each Job.
2021
2022 \label{ScheduleResource}
2023 \section{The Schedule Resource}
2024 \index[general]{Resource!Schedule}
2025 \index[general]{Schedule Resource}
2026
2027 The Schedule resource provides a means of automatically scheduling a Job as
2028 well as the ability to override the default Level, Pool, Storage and Messages
2029 resources. If a Schedule resource is not referenced in a Job, the Job can only
2030 be run manually. In general, you specify an action to be taken and when.
2031
2032 \begin{description}
2033
2034 \item [Schedule]
2035 \index[dir]{Schedule}
2036 \index[dir]{Directive!Schedule}
2037    Start of the Schedule directives.  No {\bf Schedule} resource is
2038    required, but you will need at least one if you want Jobs to be
2039    automatically started.
2040
2041    \label{Schdedule:Name}
2042 \item [Name = \lt{}name\gt{}]
2043    \index[dir]{Name}
2044    \index[dir]{Directive!Name}
2045    The name of the schedule being defined.  The Name directive is required.
2046
2047    \label{Schdedule:Run}
2048 \item [Run = \lt{}Job-overrides\gt{} \lt{}Date-time-specification\gt{}]
2049    \index[dir]{Run}
2050    \index[dir]{Directive!Run}
2051    The Run directive defines when a Job is to be run, and what overrides if
2052    any to apply.  You may specify multiple {\bf run} directives within a
2053    {\bf Schedule} resource.  If you do, they will all be applied (i.e.
2054    multiple schedules).  If you have two {\bf Run} directives that start at
2055    the same time, two Jobs will start at the same time (well, within one
2056    second of each other).
2057
2058    The {\bf Job-overrides} permit overriding the Level, the Storage, the
2059    Messages, and the Pool specifications provided in the Job resource.  In
2060    addition, the FullPool, the IncrementalPool, and the DifferentialPool
2061    specifications permit overriding the Pool specification according to
2062    what backup Job Level is in effect.
2063
2064    By the use of overrides, you may customize a particular Job.  For
2065    example, you may specify a Messages override for your Incremental
2066    backups that outputs messages to a log file, but for your weekly or
2067    monthly Full backups, you may send the output by email by using a
2068    different Messages override.
2069
2070    {\bf Job-overrides} are specified as: {\bf keyword=value} where the
2071    keyword is Level, Storage, Messages, Pool, FullPool, DifferentialPool,
2072    or IncrementalPool, and the {\bf value} is as defined on the respective
2073    directive formats for the Job resource.  You may specify multiple {\bf
2074    Job-overrides} on one {\bf Run} directive by separating them with one or
2075    more spaces or by separating them with a trailing comma.  For example:
2076
2077 \begin{description}
2078
2079 \item [Level=Full]
2080    \index[dir]{Level}
2081    \index[dir]{Directive!Level}
2082    is all files in the FileSet whether or not  they have changed.
2083
2084 \item [Level=Incremental]
2085    \index[dir]{Level}
2086    \index[dir]{Directive!Level}
2087    is all files that have changed since  the last backup.
2088
2089 \item [Pool=Weekly]
2090    \index[dir]{Pool}
2091    \index[dir]{Directive!Pool}
2092    specifies to use the Pool named {\bf Weekly}.
2093
2094 \item [Storage=DLT\_Drive]
2095    \index[dir]{Storage}
2096    \index[dir]{Directive!Storage}
2097    specifies to use {\bf DLT\_Drive} for  the storage device.
2098
2099 \item [Messages=Verbose]
2100    \index[dir]{Messages}
2101    \index[dir]{Directive!Messages}
2102    specifies to use the {\bf Verbose}  message resource for the Job.
2103
2104 \item [FullPool=Full]
2105    \index[dir]{FullPool}
2106    \index[dir]{Directive!FullPool}
2107    specifies to use the Pool named {\bf Full}  if the job is a full backup, or
2108 is
2109 upgraded from another type  to a full backup.
2110
2111 \item [DifferentialPool=Differential]
2112    \index[dir]{DifferentialPool}
2113    \index[dir]{Directive!DifferentialPool}
2114    specifies to use the Pool named {\bf Differential} if the job is a
2115    differential  backup.
2116
2117 \item [IncrementalPool=Incremental]
2118    \index[dir]{IncrementalPool}
2119    \index[dir]{Directive!IncrementalPool}
2120    specifies to use the Pool  named {\bf Incremental} if the job is an
2121 incremental  backup.
2122
2123
2124 \item [WritePartAfterJob=yes\vb{}no]
2125    \index[dir]{WritePartAfterJob}
2126    \index[dir]{Directive!WritePartAfterJob}
2127    tells Bacula to request the Storage daemon to write the current part
2128    file to the device when the job is finished (see \ilink{Write Part After
2129    Job directive in the Job resource}{WritePartAfterJob}).  Please note,
2130    this directive is implemented only in version 1.37 and later.  The
2131    default is yes.  We strongly recommend that you keep this set to yes
2132    otherwise, when the last job has finished one part will remain in the
2133    spool file and restore may or may not work.
2134
2135 \end{description}
2136
2137 {\bf Date-time-specification} determines when the  Job is to be run. The
2138 specification is a repetition, and as  a default Bacula is set to run a job at
2139 the beginning of the  hour of every hour of every day of every week of every
2140 month  of every year. This is not normally what you want, so you  must specify
2141 or limit when you want the job to run. Any  specification given is assumed to
2142 be repetitive in nature and  will serve to override or limit the default
2143 repetition. This  is done by specifying masks or times for the hour, day of the
2144 month, day of the week, week of the month, week of the year,  and month when
2145 you want the job to run. By specifying one or  more of the above, you can
2146 define a schedule to repeat at  almost any frequency you want.
2147
2148 Basically, you must supply a {\bf month}, {\bf day}, {\bf hour}, and  {\bf
2149 minute} the Job is to be run. Of these four items to be specified,  {\bf day}
2150 is special in that you may either specify a day of the month  such as 1, 2,
2151 \ldots{} 31, or you may specify a day of the week such  as Monday, Tuesday, \ldots{}
2152 Sunday. Finally, you may also specify a  week qualifier to restrict the
2153 schedule to the first, second, third,  fourth, or fifth week of the month.
2154
2155 For example, if you specify only a day of the week, such as {\bf Tuesday}  the
2156 Job will be run every hour of every Tuesday of every Month. That  is the {\bf
2157 month} and {\bf hour} remain set to the defaults of  every month and all
2158 hours.
2159
2160 Note, by default with no other specification, your job will run  at the
2161 beginning of every hour. If you wish your job to run more than  once in any
2162 given hour, you will need to specify multiple {\bf run}  specifications each
2163 with a different minute.
2164
2165 The date/time to run the Job can be specified in the following way  in
2166 pseudo-BNF:
2167
2168 \footnotesize
2169 \begin{lstlisting}
2170 <void-keyword>    = on
2171 <at-keyword>      = at
2172 <week-keyword>    = 1st | 2nd | 3rd | 4th | 5th | first |
2173                     second | third | fourth | fifth
2174 <wday-keyword>    = sun | mon | tue | wed | thu | fri | sat |
2175                     sunday | monday | tuesday | wednesday |
2176                     thursday | friday | saturday
2177 <week-of-year-keyword> = w00 | w01 | ... w52 | w53
2178 <month-keyword>   = jan | feb | mar | apr | may | jun | jul |
2179                     aug | sep | oct | nov | dec | january |
2180                     february | ... | december
2181 <daily-keyword>   = daily
2182 <weekly-keyword>  = weekly
2183 <monthly-keyword> = monthly
2184 <hourly-keyword>  = hourly
2185 <digit>           = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0
2186 <number>          = <digit> | <digit><number>
2187 <12hour>          = 0 | 1 | 2 | ... 12
2188 <hour>            = 0 | 1 | 2 | ... 23
2189 <minute>          = 0 | 1 | 2 | ... 59
2190 <day>             = 1 | 2 | ... 31
2191 <time>            = <hour>:<minute> |
2192                     <12hour>:<minute>am |
2193                     <12hour>:<minute>pm
2194 <time-spec>       = <at-keyword> <time> |
2195                     <hourly-keyword>
2196 <date-keyword>    = <void-keyword>  <weekly-keyword>
2197 <day-range>       = <day>-<day>
2198 <month-range>     = <month-keyword>-<month-keyword>
2199 <wday-range>      = <wday-keyword>-<wday-keyword>
2200 <range>           = <day-range> | <month-range> |
2201                           <wday-range>
2202 <date>            = <date-keyword> | <day> | <range>
2203 <date-spec>       = <date> | <date-spec>
2204 <day-spec>        = <day> | <wday-keyword> |
2205                     <day> | <wday-range> |
2206                     <week-keyword> <wday-keyword> |
2207                     <week-keyword> <wday-range> |
2208                     <daily-keyword>
2209 <month-spec>      = <month-keyword> | <month-range> |
2210                     <monthly-keyword>
2211 <date-time-spec>  = <month-spec> <day-spec> <time-spec>
2212 \end{lstlisting}
2213 \normalsize
2214
2215 \end{description}
2216
2217 Note, the Week of Year specification wnn follows the ISO standard definition
2218 of the week of the year, where Week 1 is the week in which the first Thursday
2219 of the year occurs, or alternatively, the week which contains the 4th of
2220 January. Weeks are numbered w01 to w53. w00 for Bacula is the week that
2221 precedes the first ISO week (i.e. has the first few days of the year if any
2222 occur before Thursday). w00 is not defined by the ISO specification. A week
2223 starts with Monday and ends with Sunday.
2224
2225 According to the NIST (US National Institute of Standards and Technology),
2226 12am and 12pm are ambiguous and can be defined to anything.  However,
2227 12:01am is the same as 00:01 and 12:01pm is the same as 12:01, so Bacula
2228 defines 12am as 00:00 (midnight) and 12pm as 12:00 (noon).  You can avoid
2229 this abiguity (confusion) by using 24 hour time specifications (i.e.  no
2230 am/pm). This is the definition in Bacula version 2.0.3 and later.
2231
2232 An example schedule resource that is named {\bf WeeklyCycle} and runs a job
2233 with level full each Sunday at 2:05am and an incremental job Monday through
2234 Saturday at 2:05am is:
2235
2236 \footnotesize
2237 \begin{lstlisting}
2238 Schedule {
2239   Name = "WeeklyCycle"
2240   Run = Level=Full sun at 2:05
2241   Run = Level=Incremental mon-sat at 2:05
2242 }
2243 \end{lstlisting}
2244 \normalsize
2245
2246 An example of a possible monthly cycle is as follows:
2247
2248 \footnotesize
2249 \begin{lstlisting}
2250 Schedule {
2251   Name = "MonthlyCycle"
2252   Run = Level=Full Pool=Monthly 1st sun at 2:05
2253   Run = Level=Differential 2nd-5th sun at 2:05
2254   Run = Level=Incremental Pool=Daily mon-sat at 2:05
2255 }
2256 \end{lstlisting}
2257 \normalsize
2258
2259 The first of every month:
2260
2261 \footnotesize
2262 \begin{lstlisting}
2263 Schedule {
2264   Name = "First"
2265   Run = Level=Full on 1 at 2:05
2266   Run = Level=Incremental on 2-31 at 2:05
2267 }
2268 \end{lstlisting}
2269 \normalsize
2270
2271 Every 10 minutes:
2272
2273 \footnotesize
2274 \begin{lstlisting}
2275 Schedule {
2276   Name = "TenMinutes"
2277   Run = Level=Full hourly at 0:05
2278   Run = Level=Full hourly at 0:15
2279   Run = Level=Full hourly at 0:25
2280   Run = Level=Full hourly at 0:35
2281   Run = Level=Full hourly at 0:45
2282   Run = Level=Full hourly at 0:55
2283 }
2284 \end{lstlisting}
2285 \normalsize
2286
2287 \section{Technical Notes on Schedules}
2288 \index[general]{Schedules!Technical Notes on}
2289 \index[general]{Technical Notes on Schedules}
2290
2291 Internally Bacula keeps a schedule as a bit mask. There are six masks and a
2292 minute field to each schedule. The masks are hour, day of the month (mday),
2293 month, day of the week (wday), week of the month (wom), and week of the year
2294 (woy). The schedule is initialized to have the bits of each of these masks
2295 set, which means that at the beginning of every hour, the job will run. When
2296 you specify a month for the first time, the mask will be cleared and the bit
2297 corresponding to your selected month will be selected. If you specify a second
2298 month, the bit corresponding to it will also be added to the mask. Thus when
2299 Bacula checks the masks to see if the bits are set corresponding to the
2300 current time, your job will run only in the two months you have set. Likewise,
2301 if you set a time (hour), the hour mask will be cleared, and the hour you
2302 specify will be set in the bit mask and the minutes will be stored in the
2303 minute field.
2304
2305 For any schedule you have defined, you can see how these bits are set by doing
2306 a {\bf show schedules} command in the Console program. Please note that the
2307 bit mask is zero based, and Sunday is the first day of the week (bit zero).
2308
2309 \input{fileset}
2310 \input{bsplugins}
2311
2312 \label{ClientResource2}
2313 \section{The Client Resource}
2314 \index[general]{Resource!Client}
2315 \index[general]{Client Resource}
2316
2317 The Client resource defines the attributes of the Clients that are served by
2318 this Director; that is the machines that are to be backed up. You will need
2319 one Client resource definition for each machine to be backed up.
2320
2321 \begin{description}
2322
2323 \item [Client (or FileDaemon)]
2324    \index[dir]{Client (or FileDaemon)}
2325    \index[dir]{Directive!Client (or FileDaemon)}
2326    Start of the Client directives.
2327
2328    \label{Client:Name}
2329 \item [Name = \lt{}name\gt{}]
2330    \index[dir]{Name}
2331    \index[dir]{Directive!Name}
2332    The client name which will be used in the  Job resource directive or in the
2333 console run command.  This directive is required.
2334
2335    \label{Client:Address}
2336 \item [Address = \lt{}address\gt{}]
2337    \index[dir]{Address}
2338    \index[dir]{Directive!FD Address}
2339    \index[dir]{File Daemon Address}
2340    \index[dir]{Client Address}
2341    Where the address is a host name, a fully qualified domain name, or a
2342    network address in dotted quad notation for a Bacula File server daemon.
2343    This directive is required.
2344
2345    \label{Client:FdPort}
2346 \item [FD Port = \lt{}port-number\gt{}]
2347    \index[dir]{FD Port}
2348    \index[dir]{Directive!FD Port}
2349    Where the port is a port  number at which the Bacula File server daemon can
2350    be contacted.  The default is 9102.
2351
2352    \label{Client:Catalog}
2353 \item [Catalog = \lt{}Catalog-resource-name\gt{}]
2354    \index[dir]{Catalog}
2355    \index[dir]{Directive!Catalog}
2356    This specifies the  name of the catalog resource to be used for this Client.
2357    This directive is required.
2358
2359    \label{Client:Password}
2360 \item [Password = \lt{}password\gt{}]
2361    \index[dir]{Password}
2362    \index[dir]{Directive!Password}
2363    This is the password to be  used when establishing a connection with the File
2364    services, so  the Client configuration file on the machine to be backed up
2365    must  have the same password defined for this Director. This directive is
2366    required.  If you have either {\bf /dev/random}  {\bf bc} on your machine,
2367    Bacula will generate a random  password during the configuration process,
2368    otherwise it will  be left blank.
2369
2370    The password is plain text.  It is not generated through any special
2371    process, but it is preferable for security reasons to make the text
2372    random.
2373 \label{FileRetention}
2374
2375    \label{FileRetention}
2376    \label{Client:FileRetention}
2377 \item [File Retention = \lt{}time-period-specification\gt{}]
2378    \index[dir]{File Retention}
2379    \index[dir]{Directive!File Retention}
2380    The File Retention directive defines the length of time that  Bacula will
2381    keep File records in the Catalog database after the End time of the
2382    Job corresponding to the File records.
2383    When this time period expires, and if
2384    {\bf AutoPrune} is set to  {\bf yes} Bacula will prune (remove) File records
2385    that  are older than the specified File Retention period. Note, this  affects
2386    only records in the catalog database. It does not  affect your archive
2387    backups.
2388
2389    File records  may actually be retained for a shorter period than you specify
2390    on  this directive if you specify either a shorter {\bf Job Retention}  or a
2391    shorter {\bf Volume Retention} period. The shortest  retention period of the
2392    three takes precedence.  The time may be expressed in seconds, minutes,
2393    hours, days, weeks, months, quarters, or years. See the
2394    \ilink{ Configuration chapter}{Time} of this  manual for
2395    additional details of time specification.
2396
2397    The  default is 60 days.
2398
2399    \label{JobRetention}
2400    \label{Client:JobRetention}
2401 \item [Job Retention = \lt{}time-period-specification\gt{}]
2402    \index[dir]{Job Retention}
2403    \index[dir]{Directive!Job Retention}
2404    The Job Retention directive defines the length of time that  Bacula will keep
2405    Job records in the Catalog database after the Job End time.  When
2406    this time period expires, and if {\bf AutoPrune} is set to {\bf yes}
2407    Bacula will prune (remove) Job records that are older than the specified
2408    File Retention period.  As with the other retention periods, this
2409    affects only records in the catalog and not data in your archive backup.
2410
2411    If a Job record is selected for pruning, all associated File and JobMedia
2412    records will also be pruned regardless of the File Retention period set.
2413    As a consequence, you normally will set the File retention period to be
2414    less than the Job retention period.  The Job retention period can actually
2415    be less than the value you specify here if you set the {\bf Volume
2416    Retention} directive in the Pool resource to a smaller duration.  This is
2417    because the Job retention period and the Volume retention period are
2418    independently applied, so the smaller of the two takes precedence.
2419
2420    The Job retention period is specified as seconds,  minutes, hours, days,
2421    weeks, months,  quarters, or years.  See the
2422    \ilink{ Configuration chapter}{Time} of this manual for
2423    additional details of  time specification.
2424
2425    The default is 180 days.
2426 \label{AutoPrune}
2427
2428    \label{Client:AutoPrune}
2429 \item [AutoPrune = \lt{}yes\vb{}no\gt{}]
2430    \index[dir]{AutoPrune}
2431    \index[dir]{Directive!AutoPrune}
2432    If AutoPrune is set to  {\bf yes} (default), Bacula (version 1.20 or greater)
2433    will  automatically apply the File retention period and the Job  retention
2434    period for the Client at the end of the Job.  If you set {\bf AutoPrune = no},
2435    pruning will not be done,  and your Catalog will grow in size each time you
2436    run a Job.  Pruning affects only information in the catalog and not data
2437    stored in the backup archives (on Volumes).
2438
2439    \label{Client:MaximumConcurrentJobs}
2440 \item [Maximum Concurrent Jobs = \lt{}number\gt{}]
2441    \index[dir]{Maximum Concurrent Jobs}
2442    \index[dir]{Directive!Maximum Concurrent Jobs}
2443    where \lt{}number\gt{}  is the maximum number of Jobs with the current Client
2444    that  can run concurrently. Note, this directive limits only Jobs  for Clients
2445    with the same name as the resource in which it appears. Any  other
2446    restrictions on the maximum concurrent jobs such as in  the Director, Job, or
2447    Storage resources will also apply in addition to  any limit specified here.
2448    The  default is set to 1, but you may set it to a larger number.
2449
2450 \label{Client:MaximumBandwidthPerJob}
2451 \item [Maximum Bandwidth Per Job = \lt{}speed\gt{}]
2452 \index[dir]{Maximum Bandwidth Per Job}
2453 \index[dir]{Directive!Maximum Bandwidth Per Job}
2454
2455 The speed parameter specifies the maximum allowed bandwidth that a job may use
2456 when started for this Client. The speed parameter should be specified in
2457 k/s, Kb/s, m/s or Mb/s.
2458
2459 % \item [FD Storage Address = \lt{}address\gt{}]
2460 %    \index[dir]{FDStorageAddress}
2461 %    \index[dir]{Directive!FD Storage Address}
2462 %    \index[dir]{Storage daemon Address}
2463 %
2464 %    Where the address is a host name, a {\bf fully qualified domain name}, or an
2465 %    {\bf IP address}. Please note that the \lt{}address\gt{} as specified here
2466 %    will be transmitted to the File daemon instead of the Storage
2467 %    \texttt{Address} who will then use it to contact the Storage daemon. This
2468 %    directive can be used in NAT environment where the configuration of the
2469 %    Client resolver is not possible. Note that using this directive will not allow
2470 %    to use multiple Storage Daemon for Backup/Restore jobs.
2471 %
2472 % \begin{figure}[htbp]
2473 %   \centering
2474 %   \includegraphics[width=10cm]{\idir BackupOverWan1}
2475 %   \caption{Backup over WAN using FD Storage Address}
2476 % \end{figure}
2477
2478    \label{Client:Priority}
2479 \item [Priority = \lt{}number\gt{}]
2480    \index[dir]{Priority}
2481    \index[dir]{Directive!Priority}
2482    The number specifies the  priority of this client relative to other clients
2483    that the  Director is processing simultaneously. The priority can range  from
2484    1 to 1000. The clients are ordered such that the smaller  number priorities
2485    are performed first (not currently  implemented).
2486 \end{description}
2487
2488    The following is an example of a valid Client resource definition:
2489
2490 \footnotesize
2491 \begin{lstlisting}
2492 Client {
2493   Name = Minimatou
2494   FDAddress = minimatou
2495   Catalog = MySQL
2496   Password = very_good
2497 }
2498 \end{lstlisting}
2499 \normalsize
2500
2501 \label{StorageResource2}
2502 \section{The Storage Resource}
2503 \index[general]{Resource!Storage}
2504 \index[general]{Storage Resource}
2505
2506 The Storage resource defines which Storage daemons are available for use by
2507 the Director.
2508
2509 \begin{description}
2510
2511 \item [Storage]
2512    \index[dir]{Storage}
2513    \index[dir]{Directive!Storage}
2514    Start of the Storage resources. At least one  storage resource must be
2515    specified.
2516
2517    \label{Storage:Name}
2518 \item [Name = \lt{}name\gt{}]
2519    \index[dir]{Name}
2520    \index[dir]{Directive!Name}
2521    The name of the storage resource. This  name appears on the Storage directive
2522    specified in the Job resource and is required.
2523
2524    \label{Storage:Address}
2525 \item [Address = \lt{}address\gt{}]
2526    \index[dir]{Address}
2527    \index[dir]{Directive!SD Address}
2528    \index[dir]{Storage daemon Address}
2529    Where the address is a host name,  a {\bf fully qualified domain name}, or an
2530    {\bf IP address}. Please note  that the \lt{}address\gt{} as specified here
2531    will be transmitted to  the File daemon who will then use it to contact the
2532    Storage daemon. Hence,  it is {\bf not}, a good idea to use {\bf localhost} as
2533    the  name but rather a fully qualified machine name or an IP address.  This
2534    directive is required.
2535
2536    \label{Storage:FDStorageAddress}
2537  \item [FD Storage Address = \lt{}address\gt{}]
2538    \index[dir]{FDStorageAddress}
2539    \index[dir]{Directive!FD Storage Address} \index[dir]{Storage daemon
2540      Address} Where the address is a host name, a {\bf fully qualified domain
2541      name}, or an {\bf IP address}. Please note that the \lt{}address\gt{} as
2542    specified here will be transmitted to the File daemon instead of the
2543    \texttt{Address} who will then use it to contact the Storage daemon. This
2544    directive can be used in NAT environment where the configuration of the
2545    Client resolver is not possible.
2546
2547 \begin{figure}[htbp]
2548   \centering
2549   \includegraphics[width=10cm]{\idir BackupOverWan1}
2550   \caption{Backup over WAN using FD Storage Address}
2551 \end{figure}
2552
2553    \label{Storage:SdPort}
2554 \item [SD Port = \lt{}port\gt{}]
2555    \index[dir]{SD Port}
2556    \index[dir]{Directive!SD Port}
2557    Where port is the port to use to  contact the storage daemon for information
2558    and to start jobs.  This same port number must appear in the Storage resource
2559    of the  Storage daemon's configuration file. The default is 9103.
2560
2561    \label{Storage:Password}
2562 \item [Password = \lt{}password\gt{}]
2563    \index[dir]{Password}
2564    \index[dir]{Directive!Password}
2565    This is the password to be used  when establishing a connection with the
2566    Storage services. This  same password also must appear in the Director
2567    resource of the Storage  daemon's configuration file. This directive is
2568    required.  If you have either {\bf /dev/random}  {\bf bc} on your machine,
2569    Bacula will generate a random  password during the configuration process,
2570    otherwise it will  be left blank.
2571
2572    The password is plain text.  It is not generated through any special
2573    process, but it is preferable for security reasons to use random text.
2574
2575    \label{Storage:Device}
2576 \item [Device = \lt{}device-name\gt{}]
2577    \index[dir]{Device}
2578    \index[dir]{Directive!Device}
2579    This directive specifies the Storage daemon's name of the device
2580    resource to be used for the storage.  If you are using an Autochanger,
2581    the name specified here should be the name of the Storage daemon's
2582    Autochanger resource rather than the name of an individual device.  This
2583    name is not the physical device name, but the logical device name as
2584    defined on the {\bf Name} directive contained in the {\bf Device} or the
2585    {\bf Autochanger} resource definition of the {\bf Storage daemon}
2586    configuration file.  You can specify any name you would like (even the
2587    device name if you prefer) up to a maximum of 127 characters in length.
2588    The physical device name associated with this device is specified in the
2589    {\bf Storage daemon} configuration file (as {\bf Archive Device}).
2590    Please take care not to define two different Storage resource directives
2591    in the Director that point to the same Device in the Storage daemon.
2592    Doing so may cause the Storage daemon to block (or hang) attempting to
2593    open the same device that is already open.  This directive is required.
2594 \label{MediaType}
2595
2596    \label{Storage:MediaType}
2597 \item [Media Type = \lt{}MediaType\gt{}]
2598    \index[dir]{Media Type}
2599    \index[dir]{Directive!Media Type}
2600    This directive specifies the Media Type to be used to store the data.
2601    This is an arbitrary string of characters up to 127 maximum that you
2602    define.  It can be anything you want.  However, it is best to make it
2603    descriptive of the storage media (e.g.  File, DAT, ``HP DLT8000'', 8mm,
2604    \ldots{}).  In addition, it is essential that you make the {\bf Media Type}
2605    specification unique for each storage media type.  If you have two DDS-4
2606    drives that have incompatible formats, or if you have a DDS-4 drive and
2607    a DDS-4 autochanger, you almost certainly should specify different {\bf
2608    Media Types}.  During a restore, assuming a {\bf DDS-4} Media Type is
2609    associated with the Job, Bacula can decide to use any Storage daemon
2610    that supports Media Type {\bf DDS-4} and on any drive that supports it.
2611
2612    If you are writing to disk Volumes, you must make doubly sure that each
2613    Device resource defined in the Storage daemon (and hence in the
2614    Director's conf file) has a unique media type.  Otherwise for Bacula
2615    versions 1.38 and older, your restores may not work because Bacula
2616    will assume that you can mount any Media Type with the same name on
2617    any Device associated with that Media Type. This is possible with
2618    tape drives, but with disk drives, unless you are very clever you
2619    cannot mount a Volume in any directory -- this can be done by creating
2620    an appropriate soft link.
2621
2622    Currently Bacula permits only a single Media Type per Storage
2623    and Device definition. Consequently, if
2624    you have a drive that supports more than one Media Type, you can
2625    give a unique string to Volumes with different intrinsic Media
2626    Type (Media Type = DDS-3-4 for DDS-3 and DDS-4 types), but then
2627    those volumes will only be mounted on drives indicated with the
2628    dual type (DDS-3-4).
2629
2630    If you want to tie Bacula to using a single Storage daemon or drive, you
2631    must specify a unique Media Type for that drive.  This is an important
2632    point that should be carefully understood.  Note, this applies equally
2633    to Disk Volumes.  If you define more than one disk Device resource in
2634    your Storage daemon's conf file, the Volumes on those two devices are in
2635    fact incompatible because one can not be mounted on the other device
2636    since they are found in different directories.  For this reason, you
2637    probably should use two different Media Types for your two disk Devices
2638    (even though you might think of them as both being File types).  You can
2639    find more on this subject in the \ilink{Basic Volume
2640    Management}{DiskChapter} chapter of this manual.
2641
2642    The {\bf MediaType} specified in the Director's Storage resource, {\bf
2643    must} correspond to the {\bf Media Type} specified in the {\bf Device}
2644    resource of the {\bf Storage daemon} configuration file.  This directive
2645    is required, and it is used by the Director and the Storage daemon to
2646    ensure that a Volume automatically selected from the Pool corresponds to
2647    the physical device.  If a Storage daemon handles multiple devices (e.g.
2648    will write to various file Volumes on different partitions), this
2649    directive allows you to specify exactly which device.
2650
2651    As mentioned above, the value specified in the Director's Storage
2652    resource must agree with the value specified in the Device resource in
2653    the {\bf Storage daemon's} configuration file.  It is also an additional
2654    check so that you don't try to write data for a DLT onto an 8mm device.
2655 \label{Autochanger1}
2656
2657    \label{Storage:Autochanger}
2658 \item [Autochanger = \lt{}yes\vb{}no\gt{}]
2659    \index[dir]{Autochanger}
2660    \index[dir]{Directive!Autochanger}
2661    If you specify {\bf yes} for this command (the default is {\bf no}),
2662    when you use the {\bf label} command or the {\bf add} command to create
2663    a new Volume, {\bf Bacula} will also request the Autochanger Slot
2664    number.  This simplifies creating database entries for Volumes in an
2665    autochanger.  If you forget to specify the Slot, the autochanger will
2666    not be used.  However, you may modify the Slot associated with a Volume
2667    at any time by using the {\bf update volume} or {\bf update slots}
2668    command in the console program.  When {\bf autochanger} is enabled, the
2669    algorithm used by Bacula to search for available volumes will be
2670    modified to consider only Volumes that are known to be in the
2671    autochanger's magazine.  If no {\bf in changer} volume is found, Bacula
2672    will attempt recycling, pruning, \ldots{}, and if still no volume is found,
2673    Bacula will search for any volume whether or not in the magazine.  By
2674    privileging in changer volumes, this procedure minimizes operator
2675    intervention.  The default is {\bf no}.
2676
2677    For the autochanger to be used, you must also specify {\bf Autochanger =
2678    yes} in the \ilink{Device Resource}{Autochanger} in the Storage daemon's
2679    configuration file as well as other important Storage daemon
2680    configuration information.  Please consult the \ilink{Using
2681    Autochangers}{AutochangersChapter} manual of this chapter for the
2682    details of using autochangers.
2683
2684    \label{Storage:MaximumConcurrentJobs}
2685 \item [Maximum Concurrent Jobs = \lt{}number\gt{}]
2686    \index[dir]{Maximum Concurrent Jobs}
2687    \index[dir]{Directive!Maximum Concurrent Jobs}
2688    where \lt{}number\gt{}  is the maximum number of Jobs with the current
2689    Storage resource that can run concurrently.  Note, this directive limits
2690    only Jobs for Jobs using this Storage daemon.  Any other restrictions on
2691    the maximum concurrent jobs such as in the Director, Job, or Client
2692    resources will also apply in addition to any limit specified here.  The
2693    default is set to 1, but you may set it to a larger number.  However, if
2694    you set the Storage daemon's number of concurrent jobs greater than one,
2695    we recommend that you read the waring documented under \ilink{Maximum
2696    Concurrent Jobs}{DirMaxConJobs} in the Director's resource or simply
2697    turn data spooling on as documented in the \ilink{Data
2698    Spooling}{SpoolingChapter} chapter of this manual.
2699
2700   \label{AllowCompression}
2701    \label{Storage:AllowCompression}
2702 \item [AllowCompression = \lt{}yes\vb{}no\gt{}]
2703    \index[dir]{AllowCompression}
2704    \index[dir]{Directive!AllowCompression}
2705
2706    This directive is optional, and if you specify {\bf No} (the default is {\bf
2707      Yes}), it will cause backups jobs running on this storage resource to run
2708    without client File Daemon compression.  This effectively overrides
2709    compression options in FileSets used by jobs which use this storage
2710    resource.
2711
2712    \label{Storage:Heartbeat Interval}
2713 \item [Heartbeat Interval = \lt{}time-interval\gt{}]
2714    \index[dir]{Heartbeat Interval}
2715    \index[dir]{Directive!Heartbeat}
2716    This directive is optional and if specified will cause the Director to
2717    set a keepalive interval (heartbeat) in seconds on each of the sockets
2718    it opens for the Storage resource.  This value will override any
2719    specified at the Director level.  It is implemented only on systems
2720    (Linux, \ldots{}) that provide the {\bf setsockopt} TCP\_KEEPIDLE function.
2721    The default value is zero, which means no change is made to the socket.
2722
2723 \end{description}
2724
2725 The following is an example of a valid Storage resource definition:
2726
2727 \footnotesize
2728 \begin{lstlisting}
2729 # Definition of tape storage device
2730 Storage {
2731   Name = DLTDrive
2732   Address = lpmatou
2733   Password = storage_password # password for Storage daemon
2734   Device = "HP DLT 80"    # same as Device in Storage daemon
2735   Media Type = DLT8000    # same as MediaType in Storage daemon
2736 }
2737 \end{lstlisting}
2738 \normalsize
2739
2740 \label{PoolResource}
2741 \section{The Pool Resource}
2742 \index[general]{Resource!Pool}
2743 \index[general]{Pool Resource}
2744
2745 The Pool resource defines the set of storage Volumes (tapes or files) to be
2746 used by Bacula to write the data. By configuring different Pools, you can
2747 determine which set of Volumes (media) receives the backup data. This permits,
2748 for example, to store all full backup data on one set of Volumes and all
2749 incremental backups on another set of Volumes. Alternatively, you could assign
2750 a different set of Volumes to each machine that you backup. This is most
2751 easily done by defining multiple Pools.
2752
2753 Another important aspect of a Pool is that it contains the default attributes
2754 (Maximum Jobs, Retention Period, Recycle flag, \ldots{}) that will be given to a
2755 Volume when it is created. This avoids the need for you to answer a large
2756 number of questions when labeling a new Volume. Each of these attributes can
2757 later be changed on a Volume by Volume basis using the {\bf update} command in
2758 the console program. Note that you must explicitly specify which Pool Bacula
2759 is to use with each Job. Bacula will not automatically search for the correct
2760 Pool.
2761
2762 Most often in Bacula installations all backups for all machines (Clients) go
2763 to a single set of Volumes. In this case, you will probably only use the {\bf
2764 Default} Pool. If your backup strategy calls for you to mount a different tape
2765 each day, you will probably want to define a separate Pool for each day. For
2766 more information on this subject, please see the
2767 \ilink{Backup Strategies}{StrategiesChapter} chapter of this
2768 manual.
2769
2770
2771 To use a Pool, there are three distinct steps. First the Pool must be defined
2772 in the Director's configuration file. Then the Pool must be written to the
2773 Catalog database. This is done automatically by the Director each time that it
2774 starts, or alternatively can be done using the {\bf create} command in the
2775 console program. Finally, if you change the Pool definition in the Director's
2776 configuration file and restart Bacula, the pool will be updated alternatively
2777 you can use the {\bf update pool} console command to refresh the database
2778 image. It is this database image rather than the Director's resource image
2779 that is used for the default Volume attributes. Note, for the pool to be
2780 automatically created or updated, it must be explicitly referenced by a Job
2781 resource.
2782
2783 Next the physical media must be labeled. The labeling can either be done with
2784 the {\bf label} command in the {\bf console} program or using the {\bf btape}
2785 program. The preferred method is to use the {\bf label} command in the {\bf
2786 console} program.
2787
2788 Finally, you must add Volume names (and their attributes) to the Pool. For
2789 Volumes to be used by Bacula they must be of the same {\bf Media Type} as the
2790 archive device specified for the job (i.e. if you are going to back up to a
2791 DLT device, the Pool must have DLT volumes defined since 8mm volumes cannot be
2792 mounted on a DLT drive). The {\bf Media Type} has particular importance if you
2793 are backing up to files. When running a Job, you must explicitly specify which
2794 Pool to use. Bacula will then automatically select the next Volume to use from
2795 the Pool, but it will ensure that the {\bf Media Type} of any Volume selected
2796 from the Pool is identical to that required by the Storage resource you have
2797 specified for the Job.
2798
2799 If you use the {\bf label} command in the console program to label the
2800 Volumes, they will automatically be added to the Pool, so this last step is
2801 not normally required.
2802
2803 It is also possible to add Volumes to the database without explicitly labeling
2804 the physical volume. This is done with the {\bf add} console command.
2805
2806 As previously mentioned, each time Bacula starts, it scans all the Pools
2807 associated with each Catalog, and if the database record does not already
2808 exist, it will be created from the Pool Resource definition. {\bf Bacula}
2809 probably should do an {\bf update pool} if you change the Pool definition, but
2810 currently, you must do this manually using the {\bf update pool} command in
2811 the Console program.
2812
2813 The Pool Resource defined in the Director's configuration file
2814 (bacula-dir.conf) may contain the following directives:
2815
2816 \begin{description}
2817
2818 \item [Pool]
2819    \index[dir]{Pool}
2820    \index[dir]{Directive!Pool}
2821    Start of the Pool resource.  There must be at least one Pool resource
2822    defined.
2823
2824
2825    \label{Pool:Name}
2826 \item [Name = \lt{}name\gt{}]
2827    \index[dir]{Name}
2828    \index[dir]{Directive!Name}
2829    The name of the pool.  For most applications, you will use the default
2830    pool name {\bf Default}.  This directive is required.
2831 \label{MaxVolumes}
2832
2833    \label{Pool:MaximumVolumes}
2834 \item [Maximum Volumes = \lt{}number\gt{}]
2835    \index[dir]{Maximum Volumes}
2836    \index[dir]{Directive!Maximum Volumes}
2837    This directive specifies the maximum number of volumes (tapes or files)
2838    contained in the pool.  This directive is optional, if omitted or set to
2839    zero, any number of volumes will be permitted.  In general, this
2840    directive is useful for Autochangers where there is a fixed number of
2841    Volumes, or for File storage where you wish to ensure that the backups
2842    made to disk files do not become too numerous or consume too much space.
2843
2844    \label{Pool:PoolType}
2845 \item [Pool Type = \lt{}type\gt{}]
2846    \index[dir]{Pool Type}
2847    \index[dir]{Directive!Pool Type}
2848    This directive defines the pool type, which corresponds to the type of
2849    Job being run.  It is required and may be one of the following:
2850
2851 \begin{bsysitemize}
2852   \item [Backup]
2853   \item [*Archive]
2854   \item [*Cloned]
2855   \item [*Migration]
2856   \item [*Copy]
2857   \item [*Save]
2858 \end{bsysitemize}
2859    Note, only Backup is current implemented.
2860
2861 \label{Pool:Storage}
2862 \item [Storage = \lt{}storage-resource-name\gt{}]
2863 \index[dir]{Storage}
2864 \index[dir]{Directive!Storage}
2865    The Storage directive defines the name of the storage services where you
2866    want to backup the FileSet data.  For additional details, see the
2867    \ilink{Storage Resource Chapter}{StorageResource2} of this manual.
2868    The Storage resource may also be specified in the Job resource,
2869    but the value, if any, in the Pool resource overrides any value
2870    in the Job. This Storage resource definition is not required by either
2871    the Job resource or in the Pool, but it must be specified in
2872    one or the other.  If not configuration error will result.
2873
2874    \label{Pool:UseVolumeOnce}
2875 \item [Use Volume Once = \lt{}yes\vb{}no\gt{}]
2876    \index[dir]{Use Volume Once}
2877    \index[dir]{Directive!Use Volume Once}
2878    This directive if set to {\bf yes} specifies that each volume is to be
2879    used only once.  This is most useful when the Media is a file and you
2880    want a new file for each backup that is done.  The default is {\bf no}
2881    (i.e.  use volume any number of times).  This directive will most likely
2882    be phased out (deprecated), so you are recommended to use {\bf Maximum
2883    Volume Jobs = 1} instead.
2884
2885    The value defined by this directive in the bacula-dir.conf file is the
2886    default value used when a Volume is created.  Once the volume is
2887    created, changing the value in the bacula-dir.conf file will not change
2888    what is stored for the Volume.  To change the value for an existing
2889    Volume you must use the {\bf update} command in the Console.
2890
2891    Please see the notes below under {\bf Maximum Volume Jobs} concerning
2892    using this directive with multiple simultaneous jobs.
2893
2894    \label{Pool:MaximumVolumeJobs}
2895 \item [Maximum Volume Jobs = \lt{}positive-integer\gt{}]
2896    \index[dir]{Maximum Volume Jobs}
2897    \index[dir]{Directive!Maximum Volume Jobs}
2898    This directive specifies the maximum number of Jobs that can be written
2899    to the Volume.  If you specify zero (the default), there is no limit.
2900    Otherwise, when the number of Jobs backed up to the Volume equals {\bf
2901    positive-integer} the Volume will be marked {\bf Used}.  When the Volume
2902    is marked {\bf Used} it can no longer be used for appending Jobs, much
2903    like the {\bf Full} status but it can be recycled if recycling is
2904    enabled, and thus used again.  By setting {\bf MaximumVolumeJobs} to
2905    one, you get the same effect as setting {\bf UseVolumeOnce = yes}.
2906
2907    The value defined by this directive in the  bacula-dir.conf
2908    file is the default value used when a Volume  is created. Once the volume is
2909    created, changing the value  in the bacula-dir.conf file will not change what
2910    is stored  for the Volume. To change the value for an existing Volume  you
2911    must use the {\bf update} command in the Console.
2912
2913    If you are running multiple simultaneous jobs, this directive may not
2914    work correctly because when a drive is reserved for a job, this
2915    directive is not taken into account, so multiple jobs may try to
2916    start writing to the Volume. At some point, when the Media record is
2917    updated, multiple simultaneous jobs may fail since the Volume can no
2918    longer be written.
2919
2920    \label{Pool:MaximumVolumeFiles}
2921 \item [Maximum Volume Files = \lt{}positive-integer\gt{}]
2922    \index[dir]{Maximum Volume Files}
2923    \index[dir]{Directive!Maximum Volume Files}
2924    This directive specifies the maximum number of files that can be written
2925    to the Volume.  If you specify zero (the default), there is no limit.
2926    Otherwise, when the number of files written to the Volume equals {\bf
2927    positive-integer} the Volume will be marked {\bf Used}.  When the Volume
2928    is marked {\bf Used} it can no longer be used for appending Jobs, much
2929    like the {\bf Full} status but it can be recycled if recycling is
2930    enabled and thus used again.  This value is checked and the {\bf Used}
2931    status is set only at the end of a job that writes to the particular
2932    volume.
2933
2934    The value defined by this directive in the bacula-dir.conf file is the
2935    default value used when a Volume is created.  Once the volume is
2936    created, changing the value in the bacula-dir.conf file will not change
2937    what is stored for the Volume.  To change the value for an existing
2938    Volume you must use the {\bf update} command in the Console.
2939
2940    \label{Pool:MaximumVolumeBytes}
2941 \item [Maximum Volume Bytes = \lt{}size\gt{}]
2942    \index[dir]{Maximum Volume Bytes}
2943    \index[dir]{Directive!Maximum Volume Bytes}
2944    This directive specifies the maximum number of bytes that can be written
2945    to the Volume.  If you specify zero (the default), there is no limit
2946    except the physical size of the Volume.  Otherwise, when the number of
2947    bytes written to the Volume equals {\bf size} the Volume will be marked
2948    {\bf Used}.  When the Volume is marked {\bf Used} it can no longer be
2949    used for appending Jobs, much like the {\bf Full} status but it can be
2950    recycled if recycling is enabled, and thus the Volume can be re-used
2951    after recycling.  This value is checked and the {\bf Used} status set
2952    while the job is writing to the particular volume.
2953
2954    This directive is particularly useful for restricting the size
2955    of disk volumes, and will work correctly even in the case of
2956    multiple simultaneous jobs writing to the volume.
2957
2958    The value defined by this directive in the bacula-dir.conf file is the
2959    default value used when a Volume is created.  Once the volume is
2960    created, changing the value in the bacula-dir.conf file will not change
2961    what is stored for the Volume.  To change the value for an existing
2962    Volume you must use the {\bf update} command in the Console.
2963
2964    \label{Pool:VolumeUseDuration}
2965 \item [Volume Use Duration = \lt{}time-period-specification\gt{}]
2966    \index[dir]{Volume Use Duration}
2967    \index[dir]{Directive!Volume Use Duration}
2968    The Volume Use Duration directive defines the time period that the
2969    Volume can be written beginning from the time of first data write to the
2970    Volume.  If the time-period specified is zero (the default), the Volume
2971    can be written indefinitely.  Otherwise, the next time a job
2972    runs that wants to access this Volume, and the time period from the
2973    first write to the volume (the first Job written) exceeds the
2974    time-period-specification, the Volume will be marked {\bf Used}, which
2975    means that no more Jobs can be appended to the Volume, but it may be
2976    recycled if recycling is enabled. Using the command {\bf
2977    status dir} applies algorithms similar to running jobs, so
2978    during such a command, the Volume status may also be changed.
2979    Once the Volume is
2980    recycled, it will be available for use again.
2981
2982    You might use this directive, for example, if you have a Volume used for
2983    Incremental backups, and Volumes used for Weekly Full backups.  Once the
2984    Full backup is done, you will want to use a different Incremental
2985    Volume.  This can be accomplished by setting the Volume Use Duration for
2986    the Incremental Volume to six days.  I.e.  it will be used for the 6
2987    days following a Full save, then a different Incremental volume will be
2988    used.  Be careful about setting the duration to short periods such as 23
2989    hours, or you might experience problems of Bacula waiting for a tape
2990    over the weekend only to complete the backups Monday morning when an
2991    operator mounts a new tape.
2992
2993    The use duration is checked and the {\bf Used} status is set only at the
2994    end of a job that writes to the particular volume, which means that even
2995    though the use duration may have expired, the catalog entry will not be
2996    updated until the next job that uses this volume is run. This
2997    directive is not intended to be used to limit volume sizes
2998    and will not work correctly (i.e. will fail jobs) if the use
2999    duration expires while multiple simultaneous jobs are writing
3000    to the volume.
3001
3002    Please note that the value defined by this directive in the  bacula-dir.conf
3003    file is the default value used when a Volume  is created. Once the volume is
3004    created, changing the value  in the bacula-dir.conf file will not change what
3005    is stored  for the Volume. To change the value for an existing Volume  you
3006    must use the
3007    \bsysxrlink{update volume}{UpdateCommand}{console}{command} in the \consoleman{}.
3008
3009    \label{Pool:CatalogFiles}
3010 \item [Catalog Files = \lt{}yes\vb{}no\gt{}]
3011    \index[dir]{Catalog Files}
3012    \index[dir]{Directive!Catalog Files}
3013    This directive defines whether or not you want the names of the files
3014    that were saved to be put into the catalog.  The default is {\bf yes}.
3015    The advantage of specifying {\bf Catalog Files = No} is that you will
3016    have a significantly smaller Catalog database.  The disadvantage is that
3017    you will not be able to produce a Catalog listing of the files backed up
3018    for each Job (this is often called Browsing).  Also, without the File
3019    entries in the catalog, you will not be able to use the Console {\bf
3020    restore} command nor any other command that references File entries.
3021 \label{PoolAutoPrune}
3022
3023    \label{Pool:AutoPrune}
3024 \item [AutoPrune = \lt{}yes\vb{}no\gt{}]
3025    \index[dir]{AutoPrune}
3026    \index[dir]{Directive!AutoPrune}
3027    If AutoPrune is set to {\bf yes} (default), Bacula (version 1.20 or
3028    greater) will automatically apply the Volume Retention period when new
3029    Volume is needed and no appendable Volumes exist in the Pool.  Volume
3030    pruning causes expired Jobs (older than the {\bf Volume Retention}
3031    period) to be deleted from the Catalog and permits possible recycling of
3032    the Volume.
3033 \label{VolRetention}
3034
3035    \label{Pool:VolumeRetention}
3036 \item [Volume Retention = \lt{}time-period-specification\gt{}]
3037    \index[dir]{Volume Retention}
3038    \index[dir]{Directive!Volume Retention}
3039    The Volume Retention directive defines the length of time that {\bf
3040    Bacula} will keep records associated with the Volume in
3041    the Catalog database after the End time of each Job written to the
3042    Volume.  When this time period expires, and if {\bf AutoPrune} is set to
3043    {\bf yes} Bacula may prune (remove) Job records that are older than the
3044    specified Volume Retention period if it is necessary to free up a
3045    Volume.  Recycling will not occur until it is absolutely necessary to
3046    free up a volume (i.e. no other writable volume exists).
3047    All File records associated with pruned Jobs are also
3048    pruned.  The time may be specified as seconds, minutes, hours, days,
3049    weeks, months, quarters, or years.  The {\bf Volume Retention} is
3050    applied independently of the {\bf Job Retention} and the {\bf File
3051    Retention} periods defined in the Client resource.  This means that all
3052    the retentions periods are applied in turn and that the shorter period
3053    is the one that effectively takes precedence.  Note, that when the {\bf
3054    Volume Retention} period has been reached, and it is necessary to obtain
3055    a new volume, Bacula will prune both the Job and the File records.  This
3056    pruning could also occur during a {\bf status dir} command because it
3057    uses similar algorithms for finding the next available Volume.
3058
3059    It is important to know that when the Volume Retention period expires,
3060    Bacula does not automatically recycle a Volume. It attempts to keep the
3061    Volume data intact as long as possible before over writing the Volume.
3062
3063    By defining multiple Pools with different Volume Retention periods, you
3064    may effectively have a set of tapes that is recycled weekly, another
3065    Pool of tapes that is recycled monthly and so on.  However, one must
3066    keep in mind that if your {\bf Volume Retention} period is too short, it
3067    may prune the last valid Full backup, and hence until the next Full
3068    backup is done, you will not have a complete backup of your system, and
3069    in addition, the next Incremental or Differential backup will be
3070    promoted to a Full backup.  As a consequence, the minimum {\bf Volume
3071    Retention} period should be at twice the interval of your Full backups.
3072    This means that if you do a Full backup once a month, the minimum Volume
3073    retention period should be two months.
3074
3075    The default Volume retention period is 365 days, and either the default
3076    or the value defined by this directive in the bacula-dir.conf file is
3077    the default value used when a Volume is created.  Once the volume is
3078    created, changing the value in the bacula-dir.conf file will not change
3079    what is stored for the Volume.  To change the value for an existing
3080    Volume you must use the {\bf update} command in the Console.
3081
3082 \label{Pool:ActionOnPurge}
3083 \item [Action On Purge = \lt{Truncate}]
3084 \index[dir]{actiononpurge}
3085
3086 This directive \textbf{ActionOnPurge=Truncate} instructs Bacula to truncate the
3087 volume when it is purged with the \texttt{purge volume action=truncate}
3088 command. It is useful to prevent disk based volumes from consuming too much
3089 space.
3090
3091 \begin{lstlisting}
3092 Pool {
3093   Name = Default
3094   Action On Purge = Truncate
3095   ...
3096 }
3097 \end{lstlisting}
3098
3099 You can schedule the truncate operation at the end of your CatalogBackup job
3100 like in this example:
3101
3102 \begin{lstlisting}
3103 Job {
3104  Name = CatalogBackup
3105  ...
3106  RunScript {
3107    RunsWhen=After
3108    RunsOnClient=No
3109    Console = "purge volume action=all allpools storage=File"
3110  }
3111 }
3112 \end{lstlisting}
3113 \label{PoolScratchPool}
3114
3115    \label{Pool:ScrachPool}
3116 \item [ScratchPool = \lt{}pool-resource-name\gt{}]
3117    \index[dir]{ScrachPool}
3118    \index[dir]{Directive!ScrachPool}
3119    This directive permits to specify a dedicate \textsl{Scratch} for the
3120    current pool. This pool will replace the special pool named \textsl{Scrach}
3121    for volume selection. For more information about \textsl{Scratch} see
3122    \ilink{Scratch Pool}{TheScratchPool} section of this manual. This is useful
3123    when using multiple storage sharing the same mediatype or when you want to
3124    dedicate volumes to a particular set of pool.
3125 \label{PoolRecyclePool}
3126
3127    \label{Pool:RecyclePool}
3128 \item [RecyclePool = \lt{}pool-resource-name\gt{}]
3129    \index[dir]{RecyclePool}
3130    \index[dir]{Directive!RecyclePool}
3131    This directive defines to which pool
3132    the Volume will be placed (moved) when it is recycled. Without
3133    this directive, a Volume will remain in the same pool when it is
3134    recycled. With this directive, it can be moved automatically to any
3135    existing pool during a recycle. This directive is probably most
3136    useful when defined in the Scratch pool, so that volumes will
3137    be recycled back into the Scratch pool. For more on the see the
3138    \ilink{Scratch Pool}{TheScratchPool} section of this manual.
3139
3140    Although this directive is called RecyclePool, the Volume in
3141    question is actually moved from its current pool to the one
3142    you specify on this directive when Bacula prunes the Volume and
3143    discovers that there are no records left in the catalog and hence
3144    marks it as {\bf Purged}.
3145
3146 \label{PoolRecycle}
3147
3148    \label{Pool:Recycle}
3149 \item [Recycle = \lt{}yes\vb{}no\gt{}]
3150    \index[dir]{Recycle}
3151    \index[dir]{Directive!Recycle}
3152    This directive specifies whether or not Purged Volumes may be recycled.
3153    If it is set to {\bf yes} (default) and Bacula needs a volume but finds
3154    none that are appendable, it will search for and recycle (reuse) Purged
3155    Volumes (i.e.  volumes with all the Jobs and Files expired and thus
3156    deleted from the Catalog).  If the Volume is recycled, all previous data
3157    written to that Volume will be overwritten. If Recycle is set to {\bf
3158    no}, the Volume will not be recycled, and hence, the data will remain
3159    valid.  If you want to reuse (re-write) the Volume, and the recycle flag
3160    is no (0 in the catalog), you may manually set the recycle flag (update
3161    command) for a Volume to be reused.
3162
3163    Please note that the value defined by this directive in the
3164    bacula-dir.conf file is the default value used when a Volume is created.
3165    Once the volume is created, changing the value in the bacula-dir.conf
3166    file will not change what is stored for the Volume.  To change the value
3167    for an existing Volume you must use the {\bf update} command in the
3168    Console.
3169
3170    When all Job and File records have been pruned or purged from the
3171    catalog for a particular Volume, if that Volume is marked as
3172    Append, Full, Used, or Error, it will then be marked as Purged. Only
3173    Volumes marked as Purged will be considered to be converted to the
3174    Recycled state if the {\bf Recycle} directive is set to {\bf yes}.
3175
3176 \label{RecycleOldest}
3177
3178    \label{Pool:RecycleOldestVolume}
3179 \item [Recycle Oldest Volume = \lt{}yes\vb{}no\gt{}]
3180    \index[dir]{Recycle Oldest Volume}
3181    \index[dir]{Directive!Recycle Oldest Volume}
3182    This directive instructs the Director to search for the oldest used
3183    Volume in the Pool when another Volume is requested by the Storage
3184    daemon and none are available.  The catalog is then {\bf pruned}
3185    respecting the retention periods of all Files and Jobs written to this
3186    Volume.  If all Jobs are pruned (i.e. the volume is Purged), then the
3187    Volume is recycled and will be used as the next Volume to be written.
3188    This directive respects any Job, File, or Volume retention periods that
3189    you may have specified, and as such it is {\bf much} better to use this
3190    directive than the Purge Oldest Volume.
3191
3192    This directive can be useful if you have a fixed number of Volumes in the
3193    Pool and you want to cycle through them and you have specified the correct
3194    retention periods.
3195
3196    However, if you use this directive and have only one
3197    Volume in the Pool, you will immediately recycle your Volume if you fill
3198    it and Bacula needs another one. Thus your backup will be totally invalid.
3199    Please use this directive with care. The default is {\bf no}.
3200 \label{RecycleCurrent}
3201
3202
3203    \label{Pool:RecycleCurrentVolume}
3204 \item [Recycle Current Volume = \lt{}yes\vb{}no\gt{}]
3205    \index[dir]{Recycle Current Volume}
3206    \index[dir]{Directive!Recycle Current Volume}
3207    If Bacula needs a new Volume, this directive instructs Bacula to Prune
3208    the volume respecting the Job and File retention periods.  If all Jobs
3209    are pruned (i.e.  the volume is Purged), then the Volume is recycled and
3210    will be used as the next Volume to be written.  This directive respects
3211    any Job, File, or Volume retention periods that you may have specified,
3212    and thus it is {\bf much} better to use it rather than the Purge Oldest
3213    Volume directive.
3214
3215    This directive can be useful if you have: a fixed number of Volumes in
3216    the Pool, you want to cycle through them, and you have specified
3217    retention periods that prune Volumes before you have cycled through the
3218    Volume in the Pool.
3219
3220    However, if you use this directive and have only one Volume in the Pool,
3221    you will immediately recycle your Volume if you fill it and Bacula needs
3222    another one.  Thus your backup will be totally invalid.  Please use this
3223    directive with care.  The default is {\bf no}.
3224 \label{PurgeOldest}
3225
3226
3227    \label{Pool:PurgeOldestVolume}
3228 \item [Purge Oldest Volume = \lt{}yes\vb{}no\gt{}]
3229    \index[dir]{Purge Oldest Volume}
3230    \index[dir]{Directive!Purge Oldest Volume}
3231    This directive instructs the Director to search for the oldest used
3232    Volume in the Pool when another Volume is requested by the Storage
3233    daemon and none are available.  The catalog is then {\bf purged}
3234    irrespective of retention periods of all Files and Jobs written to this
3235    Volume.  The Volume is then recycled and will be used as the next Volume
3236    to be written.  This directive overrides any Job, File, or Volume
3237    retention periods that you may have specified.
3238
3239    This directive can be useful if you have a fixed number of Volumes in
3240    the Pool and you want to cycle through them and reusing the oldest one
3241    when all Volumes are full, but you don't want to worry about setting
3242    proper retention periods.  However, by using this option you risk losing
3243    valuable data.
3244
3245    Please be aware that {\bf Purge Oldest Volume} disregards all retention
3246    periods. If you have only a single Volume defined and you turn this
3247    variable on, that Volume will always be immediately overwritten when it
3248    fills!  So at a minimum, ensure that you have a decent number of Volumes
3249    in your Pool before running any jobs.  If you want retention periods to
3250    apply do not use this directive.  To specify a retention period, use the
3251    {\bf Volume Retention} directive (see above).
3252
3253    We {\bf highly} recommend against using this directive, because it is
3254    sure that some day, Bacula will recycle a Volume that contains current
3255    data.  The default is {\bf no}.
3256
3257    \label{Pool:FileRetention}
3258 \item [File Retention = \lt{}time-period-specification\gt{}]
3259    \index[dir]{File Retention}
3260    \index[dir]{Directive!File Retention}
3261    The File Retention directive defines the length of time that  Bacula will
3262    keep File records in the Catalog database after the End time of the
3263    Job corresponding to the File records.
3264
3265    This directive takes precedence over Client directives of the same name. For
3266    example, you can decide to increase Retention times for Archive or OffSite
3267    Pool.
3268
3269    Note, this affects only records in the catalog database. It does not affect
3270    your archive backups.
3271
3272    For more information see Client documentation about
3273    \ilink{FileRetention}{FileRetention}
3274
3275    \label{Pool:JobRetention}
3276 \item [Job Retention = \lt{}time-period-specification\gt{}]
3277    \index[dir]{Job Retention}
3278    \index[dir]{Directive!Job Retention}
3279
3280    The Job Retention directive defines the length of time that Bacula will keep
3281    Job records in the Catalog database after the Job End time.  As with the
3282    other retention periods, this affects only records in the catalog and not
3283    data in your archive backup.
3284
3285    This directive takes precedence over Client directives of the same name.
3286    For example, you can decide to increase Retention times for Archive or
3287    OffSite Pool.
3288
3289    For more information see Client side documentation
3290    \ilink{JobRetention}{JobRetention}
3291
3292    \label{Pool:CleaningPrefix}
3293 \item [Cleaning Prefix = \lt{}string\gt{}]
3294    \index[dir]{Cleaning Prefix}
3295    \index[dir]{Directive!Cleaning Prefix}
3296    This directive defines a prefix string, which if it matches the
3297    beginning of a Volume name during labeling of a Volume, the Volume will
3298    be defined with the VolStatus set to {\bf Cleaning} and thus Bacula will
3299    never attempt to use this tape.  This is primarily for use with
3300    autochangers that accept barcodes where the convention is that barcodes
3301    beginning with {\bf CLN} are treated as cleaning tapes.
3302 \label{Label}
3303
3304    \label{Pool:LabelFormat}
3305 \item [Label Format = \lt{}format\gt{}]
3306    \index[dir]{Label Format}
3307    \index[dir]{Directive!Label Format}
3308    This directive specifies the format of the labels contained in this
3309    pool.  The format directive is used as a sort of template to create new
3310    Volume names during automatic Volume labeling.
3311
3312    The {\bf format} should be specified in double quotes, and consists of
3313    letters, numbers and the special characters hyphen ({\bf -}), underscore
3314    ({\bf \_}), colon ({\bf :}), and period ({\bf .}), which are the legal
3315    characters for a Volume name.  The {\bf format} should be enclosed in
3316    double quotes (").
3317
3318    In addition, the format may contain a number of variable expansion
3319    characters which will be expanded by a complex algorithm allowing you to
3320    create Volume names of many different formats.  In all cases, the
3321    expansion process must resolve to the set of characters noted above that
3322    are legal Volume names.  Generally, these variable expansion characters
3323    begin with a dollar sign ({\bf \$}) or a left bracket ({\bf [}).  If you
3324    specify variable expansion characters, you should always enclose the
3325    format with double quote characters ({\bf "}).  For more details on
3326    variable expansion, please see the \bsysxrlink{Variable
3327    Expansion}{VarsChapter}{misc}{chapter} of the \miscman{}.
3328
3329    If no variable expansion characters are found in the string, the Volume
3330    name will be formed from the {\bf format} string appended with the
3331    a unique number that increases.  If you do not remove volumes from the
3332    pool, this number should be the number of volumes plus one, but this
3333    is not guaranteed. The unique number will be edited as four
3334    digits with leading zeros.  For example, with a {\bf Label Format =
3335    "File-"}, the first volumes will be named {\bf File-0001}, {\bf
3336    File-0002}, \ldots{}
3337
3338    With the exception of Job specific variables, you can test your {\bf
3339    LabelFormat} by using the \bsysxrlink{var}{var}{console}{command} in the
3340  \consoleman{}.
3341
3342    In almost all cases, you should enclose the format specification (part
3343    after the equal sign) in double quotes.  Please note that this directive
3344    is deprecated and is replaced in version 1.37 and greater with a Python
3345    script for creating volume names.
3346
3347 \end{description}
3348
3349 In order for a Pool to be used during a Backup Job, the Pool must have at
3350 least one Volume associated with it.  Volumes are created for a Pool using
3351 the {\bf label} or the {\bf add} commands in the {\bf Bacula Console},
3352 program.  In addition to adding Volumes to the Pool (i.e.  putting the
3353 Volume names in the Catalog database), the physical Volume must be labeled
3354 with a valid Bacula software volume label before {\bf Bacula} will accept
3355 the Volume.  This will be automatically done if you use the {\bf label}
3356 command.  Bacula can automatically label Volumes if instructed to do so,
3357 but this feature is not yet fully implemented.
3358
3359 The following is an example of a valid Pool resource definition:
3360
3361 \footnotesize
3362 \begin{lstlisting}
3363
3364 Pool {
3365   Name = Default
3366   Pool Type = Backup
3367 }
3368 \end{lstlisting}
3369 \normalsize
3370
3371 \label{TheScratchPool}
3372 \subsection{The Scratch Pool}
3373 \index[general]{Scratch Pool}
3374 In general, you can give your Pools any name you wish, but there is one
3375 important restriction: the Pool named {\bf Scratch}, if it exists behaves
3376 like a scratch pool of Volumes in that when Bacula needs a new Volume for
3377 writing and it cannot find one, it will look in the Scratch pool, and if
3378 it finds an available Volume, it will move it out of the Scratch pool into
3379 the Pool currently being used by the job.
3380
3381
3382 \label{CatalogResource}
3383 \section{The Catalog Resource}
3384 \index[general]{Resource!Catalog}
3385 \index[general]{Catalog Resource}
3386
3387 The Catalog Resource defines what catalog to use for the current job.
3388 Currently, Bacula can only handle a single database server (SQLite, MySQL,
3389 PostgreSQL) that is defined when configuring {\bf Bacula}.  However, there
3390 may be as many Catalogs (databases) defined as you wish.  For example, you
3391 may want each Client to have its own Catalog database, or you may want
3392 backup jobs to use one database and verify or restore jobs to use another
3393 database.
3394
3395 Since SQLite is compiled in, it always runs on the same machine
3396 as the Director and the database must be directly accessible (mounted) from
3397 the Director.  However, since both MySQL and PostgreSQL are networked
3398 databases, they may reside either on the same machine as the Director
3399 or on a different machine on the network.  See below for more details.
3400
3401 \begin{description}
3402
3403 \item [Catalog]
3404    \index[dir]{Catalog}
3405    \index[dir]{Directive!Catalog}
3406    Start of the Catalog resource.  At least one Catalog resource must be
3407 defined.
3408
3409
3410    \label{Catalog:Name}
3411 \item [Name = \lt{}name\gt{}]
3412    \index[dir]{Name}
3413    \index[dir]{Directive!Name}
3414    The name of the Catalog.  No necessary relation to the database server
3415    name.  This name will be specified in the Client resource directive
3416    indicating that all catalog data for that Client is maintained in this
3417    Catalog.  This directive is required.
3418
3419    \label{Catalog:Password}
3420 \item [password = \lt{}password\gt{}]
3421    \index[dir]{password}
3422    \index[dir]{Directive!password}
3423    This specifies the password to use when logging into the database.  This
3424    directive is required.
3425
3426    \label{Catalog:DbName}
3427 \item [DB Name = \lt{}name\gt{}]
3428    \index[dir]{DB Name}
3429    \index[dir]{Directive!DB Name}
3430    This specifies the name of the database.  If you use multiple catalogs
3431    (databases), you specify which one here.  If you are using an external
3432    database server rather than the internal one, you must specify a name
3433    that is known to the server (i.e.  you explicitly created the Bacula
3434    tables using this name.  This directive is required.
3435
3436    \label{Catalog:User}
3437 \item [user = \lt{}user\gt{}]
3438    \index[dir]{user}
3439    \index[dir]{Directive!user}
3440    This specifies what user name to use to log into the database.  This
3441    directive is required.
3442
3443    \label{Catalog:DbSocket}
3444 \item [DB Socket = \lt{}socket-name\gt{}]
3445    \index[dir]{DB Socket}
3446    \index[dir]{Directive!DB Socket}
3447    This is the name of  a socket to use on the local host to connect to the
3448    database. This directive is used only by MySQL and is ignored by  SQLite.
3449    Normally, if neither {\bf DB Socket} or {\bf DB Address}  are specified, MySQL
3450    will use the default socket. If the DB Socket is specified, the
3451    MySQL server must reside on the same machine as the Director.
3452
3453    \label{Catalog:DBAddress}
3454 \item [DB Address = \lt{}address\gt{}]
3455    \index[dir]{DB Address}
3456    \index[dir]{Directive!DB Address}
3457    This is the host address  of the database server. Normally, you would specify
3458    this instead  of {\bf DB Socket} if the database server is on another machine.
3459    In that case, you will also specify {\bf DB Port}. This directive  is used
3460    only by MySQL and PostgreSQL and is ignored by SQLite if provided.
3461    This directive is optional.
3462
3463    \label{Catalog:DbPort}
3464 \item [DB Port = \lt{}port\gt{}]
3465    \index[dir]{DB Port}
3466    \index[dir]{Directive!DB Port}
3467    This defines the port to  be used in conjunction with {\bf DB Address} to
3468    access the  database if it is on another machine. This directive is used  only
3469    by MySQL and PostgreSQL and is ignored by SQLite if provided.  This
3470    directive is optional.
3471
3472 %% \item [Multiple Connections = \lt{}yes\vb{}no\gt{}]
3473
3474 %% \index[dir]{Directive!Multiple Connections}
3475 %% By default, this  directive is set to no. In that case, each job that uses
3476 the
3477 %% same Catalog will use a single connection to the catalog. It will  be shared,
3478 %% and Bacula will allow only one Job at a time to  communicate. If you set this
3479 %% directive to yes, Bacula will  permit multiple connections to the database,
3480 %% and the database  must be multi-thread capable. For SQLite and PostgreSQL,
3481 %% this is  no problem. For MySQL, you must be *very* careful to have the
3482 %% multi-thread version of the client library loaded on your system.  When this
3483 %% directive is set yes, each Job will have a separate  connection to the
3484 %% database, and the database will control the  interaction between the
3485 different
3486 %% Jobs. This can significantly  speed up the database operations if you are
3487 %% running multiple  simultaneous jobs. In addition, for SQLite and PostgreSQL,
3488 %% Bacula  will automatically enable transactions. This can significantly  speed
3489 %% up insertion of attributes in the database either for  a single Job or
3490 %% multiple simultaneous Jobs.
3491
3492 %% This directive has not been tested. Please test carefully  before running it
3493 %% in production and report back your results.
3494
3495 \end{description}
3496
3497 The following is an example of a valid Catalog resource definition:
3498
3499 \footnotesize
3500 \begin{lstlisting}
3501 Catalog
3502 {
3503   Name = SQLite
3504   dbname = bacula;
3505   user = bacula;
3506   password = ""                       # no password = no security
3507 }
3508 \end{lstlisting}
3509 \normalsize
3510
3511 or for a Catalog on another machine:
3512
3513 \footnotesize
3514 \begin{lstlisting}
3515 Catalog
3516 {
3517   Name = MySQL
3518   dbname = bacula
3519   user = bacula
3520   password = ""
3521   DB Address = remote.acme.com
3522   DB Port = 1234
3523 }
3524 \end{lstlisting}
3525 \normalsize
3526
3527 \label{MessagesResource2}
3528 \section{The Messages Resource}
3529 \index[general]{Resource!Messages}
3530 \index[general]{Messages Resource}
3531
3532 For the details of the Messages Resource, please see the
3533 \ilink{Messages Resource Chapter}{MessagesChapter} of this
3534 manual.
3535
3536 \label{ConsoleResource1}
3537 \section{The Console Resource}
3538 \index[general]{Console Resource}
3539 \index[general]{Resource!Console}
3540
3541 As of Bacula version 1.33 and higher, there are three different kinds of
3542 consoles, which the administrator or user can use to interact with the
3543 Director. These three kinds of consoles comprise three different security
3544 levels.
3545
3546 \begin{bsysitemize}
3547 \item The first console type is an {\bf anonymous} or {\bf default}  console,
3548    which has full privileges.  There is no console resource necessary for
3549    this type since the password is specified in the Director's resource and
3550    consequently such consoles do not have a name as defined on a {\bf Name
3551    =} directive.  This is the kind of console that was initially
3552    implemented in versions prior to 1.33 and remains valid.  Typically you
3553    would use it only for  administrators.
3554
3555 \item The second type of console, and new to version 1.33 and  higher is a
3556    ``named'' console defined within a Console resource in both the Director's
3557    configuration file and in the Console's configuration file.  Both the
3558    names and the passwords in these two entries must match much as is the
3559    case for Client programs.
3560
3561    This second type of console begins with absolutely no privileges except
3562    those explicitly specified in the Director's Console resource.  Thus you
3563    can have multiple Consoles with different names and passwords, sort of
3564    like multiple users, each with different privileges.  As a default,
3565    these consoles can do absolutely nothing -- no commands whatsoever.  You
3566    give them privileges or rather access to commands and resources by
3567    specifying access control lists in the Director's Console resource.  The
3568    ACLs are specified by a directive followed by a list of access names.
3569    Examples of this are shown below.
3570
3571 \item The third type of console is similar to the above mentioned  one in that
3572    it requires a Console resource definition in both the Director and the
3573    Console.  In addition, if the console name, provided on the {\bf Name =}
3574    directive, is the same as a Client name, that console is permitted to
3575    use the {\bf SetIP} command to change the Address directive in the
3576    Director's client resource to the IP address of the Console.  This
3577    permits portables or other machines using DHCP (non-fixed IP addresses)
3578    to ``notify'' the Director of their current IP address.
3579 \end{bsysitemize}
3580
3581 The Console resource is optional and need not be specified. The following
3582 directives are permitted within the Director's configuration resource:
3583
3584 \begin{description}
3585
3586    \label{Console:Name}
3587 \item [Name = \lt{}name\gt{}]
3588    \index[dir]{Name}
3589    \index[dir]{Directive!Name}
3590    The name of the console. This  name must match the name specified in the
3591 Console's configuration  resource (much as is the case with Client
3592 definitions).
3593
3594    \label{Console:Password}
3595 \item [Password = \lt{}password\gt{}]
3596    \index[dir]{Password}
3597    \index[dir]{Directive!Password}
3598    Specifies the password that must be supplied for a named Bacula Console
3599    to be authorized.  The same password must appear in the {\bf Console}
3600    resource of the Console configuration file.  For added security, the
3601    password is never actually passed across the network but rather a
3602    challenge response hash code created with the password.  This directive
3603    is required.  If you have either {\bf /dev/random} {\bf bc} on your
3604    machine, Bacula will generate a random password during the configuration
3605    process, otherwise it will be left blank.
3606
3607    The password is plain text.  It is not generated through any special
3608    process.  However, it is preferable for security reasons to choose
3609    random text.
3610
3611    \label{Console:JobAcl}
3612 \item [JobACL = \lt{}name-list\gt{}]
3613    \index[dir]{JobACL}
3614    \index[dir]{Directive!JobACL}
3615    This directive is used to specify a list of Job resource names that can
3616    be accessed by the console.  Without this directive, the console cannot
3617    access any of the Director's Job resources.  Multiple Job resource names
3618    may be specified by separating them with commas, and/or by specifying
3619    multiple JobACL directives.  For example, the directive may be specified
3620    as:
3621
3622 \footnotesize
3623 \begin{lstlisting}
3624     JobACL = kernsave, "Backup client 1", "Backup client 2"
3625     JobACL = "RestoreFiles"
3626
3627 \end{lstlisting}
3628 \normalsize
3629
3630 With the above specification, the console can access the Director's  resources
3631 for the four jobs named on the JobACL directives,  but for no others.
3632
3633    \label{Console:ClientAcl}
3634 \item [ClientACL = \lt{}name-list\gt{}]
3635    \index[dir]{ClientACL}
3636    \index[dir]{Directive!ClientACL}
3637    This directive is used to  specify a list of Client resource names that can
3638 be
3639 accessed by  the console.
3640
3641    \label{Console:StorageAcl}
3642 \item [StorageACL = \lt{}name-list\gt{}]
3643    \index[dir]{StorageACL}
3644    \index[dir]{Directive!StorageACL}
3645    This directive is used to  specify a list of Storage resource names that can
3646 be accessed by  the console.
3647
3648    \label{Console:ScheduleAcl}
3649 \item [ScheduleACL = \lt{}name-list\gt{}]
3650    \index[dir]{ScheduleACL}
3651    \index[dir]{Directive!ScheduleACL}
3652    This directive is used to  specify a list of Schedule resource names that can
3653    be accessed by the console.
3654
3655    \label{Console:PoolAcl}
3656 \item [PoolACL = \lt{}name-list\gt{}]
3657    \index[dir]{PoolACL}
3658    \index[dir]{Directive!PoolACL}
3659    This directive is used to  specify a list of Pool resource names that can be
3660    accessed by the console.
3661
3662    \label{Console:FileSetAcl}
3663 \item [FileSetACL = \lt{}name-list\gt{}]
3664    \index[dir]{FileSetACL}
3665    \index[dir]{Directive!FileSetACL}
3666    This directive is used to specify a list of FileSet resource names that
3667    can be accessed by the console.
3668
3669    \label{Console:CatalogAcl}
3670 \item [CatalogACL = \lt{}name-list\gt{}]
3671    \index[dir]{CatalogACL}
3672    \index[dir]{Directive!CatalogACL}
3673    This directive is used to specify a list of Catalog resource names that
3674    can be accessed by the console.
3675
3676    \label{Console:CommandAcl}
3677 \item [CommandACL = \lt{}name-list\gt{}]
3678    \index[dir]{CommandACL}
3679    \index[dir]{Directive!CommandACL}
3680    This directive is used to specify a list of of console commands that can
3681    be executed by the console.
3682
3683    \label{Console:WhereAcl}
3684 \item [WhereACL = \lt{}string\gt{}]
3685    \index[dir]{WhereACL}
3686    \index[dir]{Directive!WhereACL}
3687    This directive permits you to specify where a restricted console
3688    can restore files. If this directive is not specified, only the
3689    default restore location is permitted (normally {\bf
3690    /tmp/bacula-restores}. If {\bf *all*} is specified any path the
3691    user enters will be accepted (not very secure), any other
3692    value specified (there may be multiple WhereACL directives) will
3693    restrict the user to use that path. For example, on a Unix system,
3694    if you specify ``/'', the file will be restored to the original
3695    location.  This directive is untested.
3696
3697 \end{description}
3698
3699 Aside from Director resource names and console command names, the special
3700 keyword {\bf *all*} can be specified in any of the above access control lists.
3701 When this keyword is present, any resource or command name (which ever is
3702 appropriate) will be accepted. For an example configuration file, please see
3703 the
3704 \ilink{Console Configuration}{ConsoleConfChapter} chapter of this
3705 manual.
3706
3707 \label{CounterResource}
3708 \section{The Counter Resource}
3709 \index[general]{Resource!Counter}
3710 \index[general]{Counter Resource}
3711
3712 The Counter Resource defines a counter variable that can be accessed by
3713 variable expansion used for creating Volume labels with the {\bf LabelFormat}
3714 directive. See the
3715 \ilink{LabelFormat}{Label} directive in this chapter for more
3716 details.
3717
3718 \begin{description}
3719
3720 \item [Counter]
3721    \index[dir]{Counter}
3722    \index[dir]{Directive!Counter}
3723    Start of the Counter resource.  Counter directives are optional.
3724
3725    \label{Counter:Name}
3726 \item [Name = \lt{}name\gt{}]
3727    \index[dir]{Name}
3728    \index[dir]{Directive!Name}
3729    The name of the Counter.  This is the name you will use in the variable
3730 expansion  to reference the counter value.
3731
3732    \label{Counter:Minimum}
3733 \item [Minimum = \lt{}integer\gt{}]
3734    \index[dir]{Minimum}
3735    \index[dir]{Directive!Minimum}
3736    This specifies the minimum  value that the counter can have. It also becomes
3737 the default.  If not supplied, zero is assumed.
3738
3739    \label{Counter:Maximum}
3740 \item [Maximum = \lt{}integer\gt{}]
3741    \index[dir]{Maximum}
3742    \index[dir]{Directive!Maximum}
3743    \index[dir]{Directive!Maximum}
3744    This is the maximum value  value that the counter can have. If not specified
3745 or set to  zero, the counter can have a maximum value of 2,147,483,648  (2 to
3746 the 31 power). When the counter is incremented past  this value, it is reset
3747 to the Minimum.
3748
3749    \label{Counter:*WrapCounter}
3750 \item [*WrapCounter = \lt{}counter-name\gt{}]
3751    \index[dir]{*WrapCounter}
3752    \index[dir]{Directive!*WrapCounter}
3753    If this value  is specified, when the counter is incremented past the
3754 maximum
3755 and thus reset to the minimum, the counter specified on the  {\bf WrapCounter}
3756 is incremented. (This is not currently  implemented).
3757
3758    \label{Counter:Catalog}
3759 \item [Catalog = \lt{}catalog-name\gt{}]
3760    \index[dir]{Catalog}
3761    \index[dir]{Directive!Catalog}
3762    If this directive is  specified, the counter and its values will be saved in
3763 the specified catalog. If this directive is not present, the  counter will be
3764 redefined each time that Bacula is started.
3765 \end{description}
3766
3767 \label{SampleDirectorConfiguration}
3768 \section{Example Director Configuration File}
3769 \index[general]{File!Example Director Configuration}
3770 \index[general]{Example Director Configuration File}
3771
3772 An example Director configuration file might be the following:
3773
3774 \footnotesize
3775 \begin{lstlisting}
3776 #
3777 # Default Bacula Director Configuration file
3778 #
3779 #  The only thing that MUST be changed is to add one or more
3780 #   file or directory names in the Include directive of the
3781 #   FileSet resource.
3782 #
3783 #  For Bacula release 1.15 (5 March 2002) -- redhat
3784 #
3785 #  You might also want to change the default email address
3786 #   from root to your address.  See the "mail" and "operator"
3787 #   directives in the Messages resource.
3788 #
3789 Director {                            # define myself
3790   Name = rufus-dir
3791   QueryFile = "/home/kern/bacula/bin/query.sql"
3792   WorkingDirectory = "/home/kern/bacula/bin/working"
3793   PidDirectory = "/home/kern/bacula/bin/working"
3794   Password = "XkSfzu/Cf/wX4L8Zh4G4/yhCbpLcz3YVdmVoQvU3EyF/"
3795 }
3796 # Define the backup Job
3797 Job {
3798   Name = "NightlySave"
3799   Type = Backup
3800   Level = Incremental                 # default
3801   Client=rufus-fd
3802   FileSet="Full Set"
3803   Schedule = "WeeklyCycle"
3804   Storage = DLTDrive
3805   Messages = Standard
3806   Pool = Default
3807 }
3808 Job {
3809   Name = "Restore"
3810   Type = Restore
3811   Client=rufus-fd
3812   FileSet="Full Set"
3813   Where = /tmp/bacula-restores
3814   Storage = DLTDrive
3815   Messages = Standard
3816   Pool = Default
3817 }
3818
3819 # List of files to be backed up
3820 FileSet {
3821   Name = "Full Set"
3822   Include {
3823     Options { signature=SHA1}
3824 #
3825 #  Put your list of files here, one per line or include an
3826 #    external list with:
3827 #
3828 #    @file-name
3829 #
3830 #  Note: / backs up everything
3831   File = /
3832 }
3833   Exclude {}
3834 }
3835 # When to do the backups
3836 Schedule {
3837   Name = "WeeklyCycle"
3838   Run = level=Full sun at 2:05
3839   Run = level=Incremental mon-sat at 2:05
3840 }
3841 # Client (File Services) to backup
3842 Client {
3843   Name = rufus-fd
3844   Address = rufus
3845   Catalog = MyCatalog
3846   Password = "MQk6lVinz4GG2hdIZk1dsKE/LxMZGo6znMHiD7t7vzF+"
3847   File Retention = 60d      # sixty day file retention
3848   Job Retention = 1y        # 1 year Job retention
3849   AutoPrune = yes           # Auto apply retention periods
3850 }
3851 # Definition of DLT tape storage device
3852 Storage {
3853   Name = DLTDrive
3854   Address = rufus
3855   Password = "jMeWZvfikUHvt3kzKVVPpQ0ccmV6emPnF2cPYFdhLApQ"
3856   Device = "HP DLT 80"      # same as Device in Storage daemon
3857   Media Type = DLT8000      # same as MediaType in Storage daemon
3858 }
3859 # Definition for a DLT autochanger device
3860 Storage {
3861   Name = Autochanger
3862   Address = rufus
3863   Password = "jMeWZvfikUHvt3kzKVVPpQ0ccmV6emPnF2cPYFdhLApQ"
3864   Device = "Autochanger"    # same as Device in Storage daemon
3865   Media Type = DLT-8000     # Different from DLTDrive
3866   Autochanger = yes
3867 }
3868 # Definition of DDS tape storage device
3869 Storage {
3870   Name = SDT-10000
3871   Address = rufus
3872   Password = "jMeWZvfikUHvt3kzKVVPpQ0ccmV6emPnF2cPYFdhLApQ"
3873   Device = SDT-10000        # same as Device in Storage daemon
3874   Media Type = DDS-4        # same as MediaType in Storage daemon
3875 }
3876 # Definition of 8mm tape storage device
3877 Storage {
3878   Name = "8mmDrive"
3879   Address = rufus
3880   Password = "jMeWZvfikUHvt3kzKVVPpQ0ccmV6emPnF2cPYFdhLApQ"
3881   Device = "Exabyte 8mm"
3882   MediaType = "8mm"
3883 }
3884 # Definition of file storage device
3885 Storage {
3886   Name = File
3887   Address = rufus
3888   Password = "jMeWZvfikUHvt3kzKVVPpQ0ccmV6emPnF2cPYFdhLApQ"
3889   Device = FileStorage
3890   Media Type = File
3891 }
3892 # Generic catalog service
3893 Catalog {
3894   Name = MyCatalog
3895   dbname = bacula; user = bacula; password = ""
3896 }
3897 # Reasonable message delivery -- send most everything to
3898 #   the email address and to the console
3899 Messages {
3900   Name = Standard
3901   mail = root@localhost = all, !skipped, !terminate
3902   operator = root@localhost = mount
3903   console = all, !skipped, !saved
3904 }
3905
3906 # Default pool definition
3907 Pool {
3908   Name = Default
3909   Pool Type = Backup
3910   AutoPrune = yes
3911   Recycle = yes
3912 }
3913 #
3914 # Restricted console used by tray-monitor to get the status of the director
3915 #
3916 Console {
3917   Name = Monitor
3918   Password = "GN0uRo7PTUmlMbqrJ2Gr1p0fk0HQJTxwnFyE4WSST3MWZseR"
3919   CommandACL = status, .status
3920 }
3921 \end{lstlisting}
3922 \normalsize