1#
2# Default Bareos Director Configuration file
3#
4#  The only thing that MUST be changed is to add one or more
5#   file or directory names in the Include directive of the
6#   FileSet resource.
7#
8#  You might also want to change the default email address
9#   from root to your address.  See the "mail" and "operator"
10#   directives in the Messages resource.
11#
12
13Director {                            # define myself
14  Name = @hostname@-dir
15  DIRPort = @dirport@                # where we listen for UA connections
16  QueryFile = "@scriptdir@/query.sql"
17  WorkingDirectory = "@working_dir@"
18  PidDirectory = "@piddir@"
19  Maximum Concurrent Jobs = 4
20  Password = "pNvX1WiXnwv2C/F7E52LGvw6rKjbbPvu2kyuPa9pVaL3"         # Console password
21  Messages = Standard
22}
23
24JobDefs {
25  Name = "DefaultJob"
26  Type = Backup
27  Level = Incremental
28  Client = @hostname@-fd
29  FileSet = FS_TESTJOB
30  Storage = File
31  Messages = Standard
32  Pool = Default
33  Priority = 10
34  Maximum Concurrent Jobs = 16
35}
36
37FileSet {
38 Name = FS_TESTJOB
39 Include {
40   File=<@tmpdir@/file-list
41 }
42}
43
44#dir: BeforeJob: run command "/bin/echo RunBeforeJob"
45#fd: ClientRunBeforeJob: ClientRunBeforeJob
46#fd: ClientAfterJob: run command "/bin/echo ClientRunAfterJob"
47#dir: AfterJob: run command "/bin/echo RunAfterJob"
48
49Job {
50  Name = "RUN_ALL_OK"
51  JobDefs = DefaultJob
52  FileSet = FS_TESTJOB
53  RunBeforeJob = "/bin/echo RunBeforeJob"
54  ClientRunBeforeJob = "/bin/echo ClientRunBeforeJob"
55  Run After Job = "/bin/echo RunAfterJob"
56  ClientRunAfterJob = "/bin/echo ClientRunAfterJob"
57  RunScript {
58    Command = "/bin/echo ClientRunBefore1"
59    Command = "/bin/echo ClientRunBefore2"
60    Command = "/bin/echo ClientRunBefore3"
61    Command = "/bin/echo ClientRunBefore4"
62    RunsWhen = Before
63  }
64}
65
66# first, you need to unzip win32/win32_runscript.zip to c:/temp
67Job {
68  Name = "RUN_WIN32"
69  JobDefs = DefaultJob
70  FileSet = FS_TESTJOB
71  RunScript {                                              # 2.4 | 2.5 | cmd /c
72     Command = "c:\\temp\\test.bat"                        # ok  | ok  | ok
73     Command = "c:\\temp\\test.bat arg1"                   # ok  | ok  | ok
74     Command = "c:/temp/test.bat"                          # ok  | ok  | ok
75     Command = "c:/temp/test.bat arg1"                     # ok  | ok  | ok
76     Command = "c:/temp/test space.bat"                    # ok  | ok  | ok
77     Command = "c:/temp/test2 space.bat"                   # ok  | ok  | ok
78     Command = "\"c:/temp/test space.bat\" arg1"           # ok  | ok  | ok
79     Command = "\"c:/temp/dir space/test.bat\" arg1"       # ok  | ok  | ok
80     Command = "c:/temp/érïc/test.bat"                     # ERR | ok  | ok
81     Command = "c:/temp/érïc/test space.bat"               # ERR | ok  | ok
82     Command = "c:/temp/testé.bat"                         # ERR | ok  | ok
83     Command = "c:/temp/érïc/testé.bat"                    # ERR | ok  | ok
84     Command = "\"c:/temp/dir space/érïc/test.bat\""       # ERR | ERR | ok
85     Command = "\"c:/temp/dir space/érïc/test space.bat\"" # ERR | ERR | ok
86     Command = "c:/temp/test space.bat arg1"               # ERR | ERR | ERR
87     Command = "c:/temp/test2 space.bat arg1"              # ERR | ERR | ERR
88     Command = "c:/temp/dir space/érïc/test.bat"           # ERR | ERR | ERR
89     Command = "c:/temp/dir space/test.bat"                # ERR | ERR | ERR
90     Command = "'c:/temp/dir space/test.bat'"              # ERR | ERR | ERR
91     Command = "\"c:/temp/éric space/test.bat\""           # ERR | ERR | ERR
92     Command = "c:/temp/éric space/test.bat"               # ERR | ERR | ERR
93     RunsWhen = Before
94     FailJobOnError = no
95  }
96}
97
98Job {
99  Name = "RUN_SUBST"
100  JobDefs = DefaultJob
101  FileSet = FS_TESTJOB
102  RunBeforeJob = "/bin/echo client_name=%c (@hostname@-fd) dir_name=%d (@hostname@-dir) jobid=%i job=%n type=%t"
103  ClientRunBeforeJob = "/bin/echo client_name=%c (@hostname@-fd) dir_name=%d (@hostname@-dir) jobid=%i job=%n type=%t"
104  ClientRunAfterJob = "/bin/echo client_name=%c (@hostname@-fd) dir_name=%d (@hostname@-dir) jobid=%i job=%n type=%t"
105  Run After Job = "/bin/echo client_name=%c (@hostname@-fd) dir_name=%d (@hostname@-dir) jobid=%i job=%n type=%t vol=%v status=%e"
106}
107
108
109#After job are after before job
110Job {
111  Name = "RUN_DIR_FAILED_BUG"
112  FileSet = FS_TESTJOB
113  JobDefs = DefaultJob
114  Run After Failed Job = "/bin/echo RunAfterFailedJob"
115  RunBeforeJob = "/bin/false"
116}
117
118#@hostname@-dir: BeforeJob: run command "/bin/false"
119#@hostname@-dir: BeforeJob: RunAfterFailedJob
120Job {
121  Name = "RUN_DIR_FAILED"
122  FileSet = FS_TESTJOB
123  JobDefs = DefaultJob
124  RunBeforeJob = "/bin/false RUN_DIR_FAILED"
125  Run After Failed Job = "/bin/echo RunAfterFailedJob"
126}
127
128#@hostname@-fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"
129#@hostname@-fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"
130#@hostname@-fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED3"
131#@hostname@-dir: AfterJob: run command "/bin/echo RunAfterFailedJob"
132Job {
133  Name = "RUN_FD_FAILED"
134  FileSet = FS_TESTJOB
135  JobDefs = DefaultJob
136  RunScript {
137    Command = "/bin/false RUN_FD_FAILED1"
138    Command = "/bin/false RUN_FD_FAILED2"
139    failjobonerror = no
140    RunsWhen = Before
141  }
142  RunScript {
143    Command = "/bin/false RUN_FD_FAILED3"
144    Command = "/bin/false RUN_FD_FAILED4"
145    failjobonerror = yes
146    RunsWhen = Before
147  }
148
149  Run After Failed Job = "/bin/echo RunAfterFailedJob"
150  RunScript {
151    Command = "/bin/echo touching @tmpdir@/RUN_FD_FAILED"
152    RunsWhen = after
153    RunsOnFailure = yes
154  }
155  RunScript {
156    Command = "/bin/touch @tmpdir@/RUN_FD_FAILED"
157    RunsWhen = after
158    RunsOnFailure = yes
159  }
160}
161
162#@hostname@-fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"
163#we don't execute FAILED2
164#@hostname@-dir: AfterJob: run command "/bin/echo RunAfterFailedJob"
165Job {
166  Name = "RUN_FD_FAILED2"
167  FileSet = FS_TESTJOB
168  JobDefs = DefaultJob
169  RunScript {
170    Command = "/bin/false RUN_FD_FAILED1"
171    failjobonerror = yes
172    RunsWhen = Before
173  }
174  RunScript {
175    Command = "/bin/false RUN_FD_FAILED2"
176    failjobonerror = yes
177    RunsWhen = Before
178  }
179  RunScript {
180    Command = "/bin/false RUN_FD_FAILED3"
181    failjobonerror = yes
182    RunsOnFailure = yes
183    RunsWhen = Before
184  }
185
186  Run After Failed Job = "/bin/echo RunAfterFailedJob"
187}
188
189#@hostname@-fd: ClientBeforeJob: run command "/bin/false RUN_FD_WARNING"
190#Backup OK -- with warnings
191Job {
192  Name = "RUN_FD_WARNING"
193  FileSet = FS_TESTJOB
194  JobDefs = DefaultJob
195  RunScript {
196    Command = "/bin/false RUN_FD_WARNING"
197    failjobonerror = no
198    RunsWhen = Before
199  }
200  Run After Failed Job = "/bin/echo RunAfterFailedJob"
201}
202
203Job {
204  Name = "RUN_CONSOLE_CMD"
205  FileSet = FS_TESTJOB
206  JobDefs = DefaultJob
207  RunScript {
208    Console = "purge volume=TestVolume001 yes"
209    Console = "st dir"
210    RunsWhen = Before
211    failjobonerror = no
212    runsonclient = no
213  }
214}
215
216Job {
217  Name = "Restore"
218  Type = Restore
219  Client = @hostname@-fd
220  FileSet = FS_TESTJOB
221  Storage = File
222  Messages = Standard
223  Pool = Default
224
225  RunScript  {
226   RunsWhen = Before
227   RunsOnClient = Yes
228   Command = "echo ClientBeforeRestore"
229  }
230
231  RunScript  {
232   RunsOnFailure = No
233   RunsWhen = After
234   RunsOnClient = Yes
235   Command = "echo ClientAfterRestore"
236  }
237
238  RunScript  {
239   RunsWhen = Before
240   RunsOnClient = No
241   Command = "echo DirBeforeRestore"
242  }
243
244  RunScript  {
245   RunsOnFailure = No
246   RunsWhen = After
247   RunsOnClient = Yes
248   Command = "echo DirAfterRestore"
249  }
250}
251
252# Client (File Services) to backup
253Client {
254  Name = @hostname@-fd
255  Address = @hostname@
256  FDPort = @fdport@
257  Catalog = MyCatalog
258  Password = "xevrjURYoCHhn26RaJoWbeWXEY/a3VqGKp/37tgWiuHc"          # password for FileDaemon
259  File Retention = 30d                # 30 days
260  Job Retention = 180d                # six months
261  AutoPrune = yes                     # Prune expired Jobs/Files
262  Maximum Concurrent Jobs = 4
263}
264
265# Definiton of file storage device
266Storage {
267  Name = File
268  Address = @hostname@                # N.B. Use a fully qualified name here
269  SDPort = @sdport@
270  Password = "ccV3lVTsQRsdIUGyab0N4sMDavui2hOBkmpBU0aQKOr9"
271  Device = FileStorage
272  Media Type = File
273  Maximum Concurrent Jobs = 4
274}
275
276# Generic catalog service
277Catalog {
278  Name = MyCatalog
279  @libdbi@
280  dbdriver = "@db_type@"
281  dbname = @db_name@
282  user = @db_user@
283  password = "@db_password@"
284}
285
286
287Messages {
288  Name = Standard
289  console = all, !skipped, !saved, !audit
290  catalog = all, !skipped, !audit
291}
292
293# Default pool definition
294Pool {
295  Name = Default
296  Pool Type = Backup
297  Recycle = yes                       # Bareos can automatically recycle Volumes
298  AutoPrune = yes                     # Prune expired volumes
299  Volume Retention = 365d             # one year
300}
301