Welcome to mirror list, hosted at ThFree Co, Russian Federation.

bconsole.tex « main « en « manuals - github.com/bareos/bareos-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 20ef931a0d0e67d1f5ca0eed21a840d3b7152e67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966

\chapter{Bareos Console}
\label{sec:bconsole}
\index[general]{Bareos Console}
\index[general]{bconsole}
\index[general]{Command!bconsole}



The {\bf Bareos Console} (\command{bconsole}) is a program that
allows the user or the System Administrator, to interact with the Bareos
Director daemon while the daemon is running.

The current Bareos Console comes as a shell interface (TTY
style). It permit the administrator or
authorized users to interact with Bareos. You can determine the status of a
particular job, examine the contents of the Catalog as well as perform certain
tape manipulations with the Console program.

Since the Console program interacts with the Director through the network, your
Console and Director programs do not necessarily need to run on the same
machine.

In fact, a certain minimal knowledge of the Console program is needed in order
for Bareos to be able to write on more than one tape, because when Bareos
requests a new tape, it waits until the user, via the Console program,
indicates that the new tape is mounted.

\section{Console Configuration}
\index[general]{Configuration!Console}
\index[general]{Configuration!bconsole}

When the Console starts, it reads a standard Bareos configuration file
named {\bf bconsole.conf} unless you specify the {\bf {-}c}
command line option (see below). This file allows default configuration
of the Console, and at the current time, the only Resource Record defined
is the Director resource, which gives the Console the name and address of
the Director.  For more information on configuration of the Console
program, please see the \ilink{Console Configuration}{ConsoleConfChapter} chapter of this document.

\section{Running the Console Program}

The console program can be run with the following options:

\index[console]{Command Line Options}
\begin{commandOut}{bconsole command line options}{}{bconsole -?}
Usage: bconsole [-s] [-c config_file] [-d debug_level]
       -D <dir>    select a Director
       -l          list Directors defined
       -c <file>   set configuration file to file
       -d <nn>     set debug level to <nn>
       -dt         print timestamp in debug output
       -n          no conio
       -s          no signals
       -u <nn>     set command execution timeout to <nn> seconds
       -t          test - read configuration and exit
       -?          print this message.
\end{commandOut}


After launching the Console program (bconsole), it will prompt you for the next
command with an asterisk (*).  Generally, for all commands, you can simply
enter the command name and the Console program will prompt you for the
necessary arguments. Alternatively, in most cases, you may enter the command
followed by arguments. The general format is:

\footnotesize
\begin{verbatim}
 <command> <keyword1>[=<argument1>] <keyword2>[=<argument2>] ...
\end{verbatim}
\normalsize

where {\bf command} is one of the commands listed below; {\bf keyword} is one
of the keywords listed below (usually followed by an argument); and {\bf
argument} is the value. The command may be abbreviated to the shortest unique
form. If two commands have the same starting letters, the one that will be
selected is the one that appears first in the {\bf help} listing. If you want
the second command, simply spell out the full command. None of the keywords
following the command may be abbreviated.

For example:

\footnotesize
\begin{verbatim}
list files jobid=23
\end{verbatim}
\normalsize

will list all files saved for JobId 23. Or:

\footnotesize
\begin{verbatim}
show pools
\end{verbatim}
\normalsize

will display all the Pool resource records.

The maximum command line length is limited to 511 characters, so if you
are scripting the console, you may need to take some care to limit the
line length.

\subsection{Exit the Console Program}
\index[general]{Command!bconsole!exit}

Normally, you simply enter {\bf quit} or {\bf exit} and the Console program
will terminate. However, it waits until the Director acknowledges the command.
If the Director is already doing a lengthy command (e.g. prune), it may take
some time. If you want to immediately terminate the Console program, enter the
{\bf .quit} command.

There is currently no way to interrupt a Console command once issued (i.e.
Ctrl-C does not work). However, if you are at a prompt that is asking you to
select one of several possibilities and you would like to abort the command,
you can enter a period ({\bf .}), and in most cases, you will either be
returned to the main command prompt or if appropriate the previous prompt (in
the case of nested prompts). In a few places such as where it is asking for a
Volume name, the period will be taken to be the Volume name. In that case, you
will most likely be able to cancel at the next prompt.


\subsection{Running the Console from a Shell Script}
\index[general]{Console!Running from a Shell}
\label{scripting}

You can automate many Console tasks by running the console program from a
shell script. For example, if you have created a file containing the following
commands:

\footnotesize
\begin{verbatim}
 bconsole -c ./bconsole.conf <<END_OF_DATA
 unmount storage=DDS-4
 quit
 END_OF_DATA
\end{verbatim}
\normalsize

when that file is executed, it will unmount the current DDS-4 storage device.
You might want to run this command during a Job by using the {\bf
RunBeforeJob} or {\bf RunAfterJob} records.

It is also possible to run the Console program from file input where the file
contains the commands as follows:

\footnotesize
\begin{verbatim}
bconsole -c ./bconsole.conf <filename
\end{verbatim}
\normalsize

where the file named {\bf filename} contains any set of console commands.

As a real example, the following script is part of the Bareos regression
tests. It labels a volume (a disk volume), runs a backup, then does a restore
of the files saved.

\footnotesize
\begin{verbatim}
bconsole <<END_OF_DATA
@output /dev/null
messages
@output /tmp/log1.out
label volume=TestVolume001
run job=Client1 yes
wait
messages
@#
@# now do a restore
@#
@output /tmp/log2.out
restore current all
yes
wait
messages
@output
quit
END_OF_DATA
\end{verbatim}
\normalsize

The output from the backup is directed to /tmp/log1.out and the output from
the restore is directed to /tmp/log2.out. To ensure that the backup and
restore ran correctly, the output files are checked with:

\footnotesize
\begin{verbatim}
grep "^ *Termination: *Backup OK" /tmp/log1.out
backupstat=$?
grep "^ *Termination: *Restore OK" /tmp/log2.out
restorestat=$?
\end{verbatim}
\normalsize


\section{Console Keywords}
\index[general]{Console!Keywords}

Unless otherwise specified, each of the following keywords
takes an argument, which is specified after the keyword following
an equal sign. For example:

\begin{verbatim}
jobid=536
\end{verbatim}

\begin{description}
\item [all]
  Permitted on the status and show commands to specify all components or
  resources respectively.
\item [allfrompool]
  Permitted on the update command to specify that all Volumes in the
  pool (specified on the command line) should be updated.
\item [allfrompools]
  Permitted on the update command to specify that all Volumes in all
  pools should be updated.
\item [before]
  Used in the restore command.
\item [bootstrap]
  Used in the restore command.
\item [catalog]
  Allowed in the use command to specify the catalog name
  to be used.
\item [catalogs]
  Used in the show command. Takes no arguments.
\item [client \textbar\ fd]
\item [clients]
  Used in the show, list, and llist commands. Takes no arguments.
\item [counters]
  Used in the show command. Takes no arguments.
\item [current]
  Used in the restore command. Takes no argument.
\item [days]
  Used to define the number of days the \bcommand{list}{nextvol} command
  should consider when looking for jobs to be run.  The days keyword
  can also be used on the \bcommand{status}{dir} command so that it will display
  jobs scheduled for the number of days you want. It can also be used on the  \bcommand{rerun}{} command, where it will automatically select all failed jobids in the last number of days for rerunning.
\item [devices]
  Used in the show command. Takes no arguments.
\item [director \textbar\ dir]
\item [directors]
  Used in the show command. Takes no arguments.
\item [directory]
  Used in the restore command. Its argument specifies the directory
  to be restored.
\item [enabled]
  This keyword can appear on the \bcommand{update}{volume} as well
  as the \bcommand{update}{slots} commands, and can
  allows one of the following arguments: yes, true, no, false, archived,
  0, 1, 2.  Where 0 corresponds to no or false, 1 corresponds to yes or true, and
  2 corresponds to archived.  Archived volumes will not be used, nor will
  the Media record in the catalog be pruned. Volumes that are not enabled,
  will not be used for backup or restore.
\item [done]
  Used in the restore command. Takes no argument.
\item [file]
  Used in the restore command.
\item [files]
  Used in the list and llist commands. Takes no arguments.
\item [fileset]
\item [filesets]
  Used in the show command. Takes no arguments.
\item [help]
  Used in the show command. Takes no arguments.
\item [hours]
  Used on the  \bcommand{rerun}{} command to select all failed jobids in the last number of hours for rerunning.
\item [jobs]
  Used in the show, list and llist commands. Takes no arguments.
\item [jobmedia]
  Used in the list and llist commands. Takes no arguments.
\item [jobtotals]
  Used in the list and llist commands. Takes no arguments.
\item [jobid]
  The JobId is the numeric jobid that is printed in the Job
  Report output. It is the index of the database record for the
  given job. While it is unique for all the existing Job records
  in the catalog database, the same JobId can be reused once a
  Job is removed from the catalog. Probably you will refer
  specific Jobs that ran using their numeric JobId.

  JobId can be used on the \bcommand{rerun} command to select all jobs failed after and including the given jobid for rerunning.
\item [job \textbar\  jobname]
  The Job or Jobname keyword refers to the name you specified
  in the Job resource, and hence it refers to any number of
  Jobs that ran.  It is typically useful if you want to list
  all jobs of a particular name.
\item [level]
\item [listing]
  Permitted on the estimate command. Takes no argument.
\item [limit]
\item [messages]
  Used in the show command. Takes no arguments.
\item [media]
  Used in the list and llist commands. Takes no arguments.
\item [nextvolume \textbar\ nextvol]
  Used in the list and llist commands. Takes no arguments.
\item [on]
  Takes no keyword.
\item [off]
  Takes no keyword.
\item [pool]
\item [pools]
  Used in the show, list, and llist commands. Takes no arguments.
\item [select]
  Used in the restore command. Takes no argument.
\item[limit]
  Used in the setbandwidth command. Takes integer in KB/s unit.
\item [schedules]
  Used in the show command. Takes no arguments.
\item [storage \textbar\ store \textbar\ sd]
\item [storages]
  Used in the show command. Takes no arguments.
\item [ujobid]
  The ujobid is a unique job identification that is printed
  in the Job Report output. At the current time, it consists
  of the Job name (from the Name directive for the job) appended
  with the date and time the job was run. This keyword is useful
  if you want to completely identify the Job instance run.
\item [volume]
\item [volumes]
  Used in the list and llist commands. Takes no arguments.
\item [where]
  Used in the restore command.
\item [yes]
  Used in the restore command. Takes no argument.
\end{description}

\section{Console Commands}
    \label{sec:ConsoleCommands}

The following commands are currently implemented:

\begin{description}
\item [add]
   \index[general]{Console!Command!add|textbf}
   This command is used to add Volumes to an existing Pool.  That is,
   it creates the Volume name in the catalog and inserts into the Pool
   in the catalog, but does not attempt to access the physical Volume.
   Once added, Bareos expects that Volume to exist and to be labeled.
   This command is not normally used since Bareos will
   automatically do the equivalent when Volumes are labeled. However,
   there may be times when you have removed a Volume from the catalog
   and want to later add it back.

   The full form of this command is:

\begin{bconsole}{add}
add [pool=<pool-name>] [storage=<storage>] [jobid=<JobId>]
\end{bconsole}

   Normally, the \bcommand{label}{} command is used rather than this command
   because the \bcommand{label}{} command labels the physical media (tape, disk,, ...)
   and does the equivalent of the \bcommand{add}{} command.
   The \bcommand{add}{} command affects only the Catalog and not the physical media (data
   on Volumes).  The physical media must exist and be labeled before use
   (usually with the \bcommand{label}{} command).  This command can, however, be
   useful if you wish to add a number of Volumes to the Pool that will be
   physically labeled at a later time.  It can also be useful if you are
   importing a tape from another site.  Please see the \bcommand{label}{} command
   for the list of legal characters in a Volume name.

\item [autodisplay]
   \index[general]{Console!Command!autodisplay on/off}
   This command accepts {\bf on} or {\bf off} as an argument, and turns
   auto-display of messages on or off respectively.  The default for the
   console program is {\bf off}, which means that you will be notified when
   there are console messages pending, but they will not automatically be
   displayed.

   When autodisplay is turned off, you must explicitly retrieve the
   messages with the {\bf messages} command.  When autodisplay is turned
   on, the messages will be displayed on the console as they are received.

\item [automount]
   \index[general]{Console!Command!automount on/off}
   This command accepts {\bf on} or {\bf off} as the argument, and turns
   auto-mounting of the Volume after a {\bf label} command on or off
   respectively.  The default is {\bf on}.  If {\bf automount} is turned
   off, you must explicitly {\bf mount} tape Volumes after a label command to
   use it.

\item [cancel]
   \index[general]{Console!Command!cancel jobid}
   This command is used to cancel a job and accepts {\bf jobid=nnn} or {\bf
   job=xxx} as an argument where nnn is replaced by the JobId and xxx is
   replaced by the job name.  If you do not specify a keyword, the Console
   program will prompt you with the names of all the active jobs allowing
   you to choose one.

   The full form of this command is:

\begin{bconsole}{cancel}
cancel [jobid=<number> job=<job-name> ujobid=<unique-jobid>]
\end{bconsole}

   Once a Job is marked to be cancelled, it may take a bit of time
   (generally within a minute but up to two hours) before the Job actually
   terminates, depending on what operations it is doing.
   Don't be surprised that you receive a Job not found message. That just
   means that one of the three daemons had already canceled the job.
   Messages numbered in the 1000's are from the Director, 2000's are from
   the File daemon and 3000's from the Storage daemon.

   It is possible to cancel multiple jobs at once. Therefore, the following extra options are available for the job-selection:

   \begin{itemize}
    \item all jobs
    \item all jobs with a created state
    \item all jobs with a blocked state
    \item all jobs with a waiting state
    \item all jobs with a running state
   \end{itemize}

   Usage:
\begin{bconsole}{cancel all}
cancel all
cancel all state=<created|blocked|waiting|running>
\end{bconsole}

   Sometimes the Director already removed the job from its running queue, but the storage daemon still thinks it is doing a backup (or another job) - so you cannot cancel the job from within a console anymore. Therefore it is possible to cancel a job by JobId on the storage daemon. It might be helpful to execute a \bcommand{status storage}{} on the Storage Daemon to make sure what job you want to cancel.

   Usage:
\begin{bconsole}{cancel on Storage Daemon}
cancel storage=<Storage Daemon> Jobid=<JobId>
\end{bconsole}

   This way you can also remove a job that blocks any other jobs from running without the need to restart the whole storage daemon.

\item [create]
   \index[general]{Console!Command!create pool}
   This command is not normally used as the Pool records are automatically
   created by the Director when it starts based on what it finds in
   the configuration.  If needed, this command can be used,
   to create a Pool record in the database using the
   Pool resource record defined in the Director's configuration file.  So
   in a sense, this command simply transfers the information from the Pool
   resource in the configuration file into the Catalog.  Normally this
   command is done automatically for you when the Director starts providing
   the Pool is referenced within a Job resource.  If you use this command
   on an existing Pool, it will automatically update the Catalog to have
   the same information as the Pool resource.  After creating a Pool, you
   will most likely use the {\bf label} command to label one or more
   volumes and add their names to the Media database.

   The full form of this command is:

\begin{bconsole}{create}
create [pool=<pool-name>]
\end{bconsole}

   When starting a Job, if Bareos determines that there is no Pool record
   in the database, but there is a Pool resource of the appropriate name,
   it will create it for you.  If you want the Pool record to appear in the
   database immediately, simply use this command to force it to be created.

\item[configure]
    \label{sec:bcommandConfigure}

    Configures director resources during runtime.
    The first configure subcommands are \bcommand{configure}{add} and \bcommand{configure}{export}.
    Other subcommands may follow in later releases.

    \begin{description}
    \item [configure add]
        \label{sec:bcommandConfigureAdd}
        \index[general]{Console!Command!configure add}

        This command allows to add resources during runtime.
        Usage:
\begin{bconsole}{}
configure add <resourcetype> name=<resourcename> <directive1>=<value1> <directive2>=<value2> ...
\end{bconsole}

    The command generates and loads a new, valid resource.
    As the new resource is also stored at

    \file{<CONFIGDIR>/bareos-dir.d/<resourcetype>/<resourcename>.conf}

    (see \nameref{sec:ConfigurationResourceFileConventions}) it is persistent upon reload and restart.

    This feature requires \nameref{sec:ConfigurationSubdirectories}.

    All kinds of resources can be added.
    When adding a client resource, the \nameref{ClientResourceDirector} for the \bareosFd is also created
    and stored at:

    \file{<CONFIGDIR>/bareos-dir-export/client/<clientname>/bareos-fd.d/director/<clientname>.conf}

\begin{bconsole}{Example: adding a client and a job resource during runtime}
*<input>configure add client name=client2-fd address=192.168.0.2 password=secret</input>
Created resource config file "/etc/bareos/bareos-dir.d/client/client2-fd.conf":
Client {
  Name = client2-fd
  Address = 192.168.0.2
  Password = secret
}
*<input>configure add job name=client2-job client=client2-fd jobdefs=DefaultJob</input>
Created resource config file "/etc/bareos/bareos-dir.d/job/client2-job.conf":
Job {
  Name = client2-job
  Client = client2-fd
  JobDefs = DefaultJob
}
\end{bconsole}

These two commands create three resource configuration files:
\begin{itemize}
  \item \file{/etc/bareos/bareos-dir.d/client/client2-fd.conf}
  \item \file{/etc/bareos/bareos-dir-export/client/client2-fd/bareos-fd.d/director/bareos-dir.conf} (assuming your director resource is named \name{bareos-dir})
  \item \file{/etc/bareos/bareos-dir.d/job/client2-job.conf}
\end{itemize}

The files in \directory{bareos-dir-export/client/} directory are not used by the \bareosDir.
However, they can be copied to new clients to configure these clients for the \bareosDir.

\warning{Don't be confused by the extensive output of \bcommand{help}{configure}. As \bcommand{configure}{add} allows configuring arbitrary resources, the output of \bcommand{help}{configure} lists all the resources, each with all valid directives. The same data is also used for \command{bconsole} command line completion.}

    Available since Bareos \sinceVersion{console}{configure add}{16.2.4}.


    \item [configure export]
        \label{sec:bcommandConfigureExport}
        \index[general]{Console!Command!configure export}

        This command allows to export the \resourcetype{Fd}{Director} resource for clients already configured in the \bareosDir.

        Usage:
\begin{bconsole}{Export the bareos-fd Director resource for the client bareos-fd}
configure export client=bareos-fd
Exported resource file "/etc/bareos/bareos-dir-export/client/bareos-fd/bareos-fd.d/director/bareos-dir.conf":
Director {
  Name = bareos-dir
  Password = "[md5]932d1d3ef3c298047809119510f4bee6"
}
\end{bconsole}

        To use it, copy the \resourcetype{Fd}{Director} resource file to the client machine 
        (on Linux: to \directory{/etc/bareos/bareos-fd.d/director/}) and restart the \bareosFd.

        Available since Bareos \sinceVersion{console}{configure export}{16.2.4}.

    \end{description}


\item [delete]
   \index[general]{Console!Command!delete}
   The delete command is used to delete a Volume, Pool or Job record from
   the Catalog as well as all associated catalog Volume records that were
   created.  This command operates only on the Catalog database and has no
   effect on the actual data written to a Volume.  This command can be
   dangerous and we strongly recommend that you do not use it unless you
   know what you are doing.

   If the keyword {\bf Volume} appears on the command line, the named
   Volume will be deleted from the catalog, if the keyword {\bf Pool}
   appears on the command line, a Pool will be deleted, and if the keyword
   {\bf Job} appears on the command line, a Job and all its associated
   records (File and JobMedia) will be deleted from the catalog.

   The full form of this command is:

\begin{bconsole}{delete}
delete pool=<pool-name>
delete volume=<volume-name> pool=<pool-name>
delete JobId=<job-id> JobId=<job-id2> ...
delete Job JobId=n,m,o-r,t ...
\end{bconsole}

   The first form deletes a Pool record from the catalog database.  The
   second form deletes a Volume record from the specified pool in the
   catalog database.  The third form deletes the specified Job record from
   the catalog database.  The last form deletes JobId records for JobIds
   n, m, o, p, q, r, and t.  Where each one of the n,m,...  is, of course, a
   number. That is a "delete jobid" accepts lists and ranges of
   jobids.

\item [disable]
  \index[general]{Console!Command!disable}
  This command permits you to disable a Job for automatic scheduling.
  The job may have been previously enabled with the Job resource
  {\bf Enabled} directive or using the console {\bf enable} command.
  The next time the Director is reloaded or restarted,
  the Enable/Disable state will be set to the value in the Job resource
  (default enabled) as defined in the \bareosDir configuration.

   The full form of this command is:
\begin{bconsole}{disable}
disable job=<job-name>
\end{bconsole}

\item [enable]
  \index[general]{Console!Command!enable}
  This command permits you to enable a Job for automatic scheduling.
  The job may have been previously disabled with the Job resource
  {\bf Enabled} directive or using the console {\bf disable} command.
  The next time the Director is reloaded or restarted,
  the Enable/Disable state will be set to the value in the Job resource
  (default enabled) as defined in the \bareosDir configuration.

   The full form of this command is:

\begin{bconsole}{enable}
enable job=<job-name>
\end{bconsole}

\label{estimate}
\item [estimate]
   \index[general]{Console!Command!estimate}
   Using this command, you can get an idea how many files will be backed
   up, or if you are unsure about your Include statements in your FileSet,
   you can test them without doing an actual backup.  The default is to
   assume a Full backup.  However, you can override this by specifying a
   {\bf level=Incremental} or {\bf level=Differential} on the command line.
   A Job name must be specified or you will be prompted for one, and
   optionally a Client and FileSet may be specified on the command line.
   It then contacts the client which computes the number of files and bytes
   that would be backed up.  Please note that this is an estimate
   calculated from the number of blocks in the file rather than by reading
   the actual bytes.  As such, the estimated backup size will generally be
   larger than an actual backup.

   The \texttt{estimate} command can use the accurate code to detect changes
   and give a better estimation. You can set the accurate behavior on command
   line using \texttt{accurate=yes/no} or use the Job setting as default value.

   Optionally you may specify the keyword {\bf listing} in  which case, all the
   files to be backed up will be listed.  Note, it could take quite some time to
   display them if the  backup is large. The full form is:

   The full form of this command is:

\begin{bconsole}{estimate}
estimate job=<job-name> listing client=<client-name> accurate=<yes|no> fileset=<fileset-name> level=<level-name>
\end{bconsole}

   Specification of the {\bf job} is sufficient, but you can also override the
   client, fileset, accurate and/or level by specifying them on the estimate
   command line.

As an example, you might do:

\begin{bconsole}{estimate: redirected output}
@output /tmp/listing
estimate job=NightlySave listing level=Incremental
@output
\end{bconsole}

   which will do a full listing of all files to be backed up for the  Job {\bf
   NightlySave} during an Incremental save and put it in the  file {\bf
   /tmp/listing}.  Note, the byte estimate provided by this command is
   based on the file size contained in the directory item. This can give
   wildly incorrect estimates of the actual storage used if there are
   sparse files on your systems. Sparse files are often found on 64 bit
   systems for certain system files. The size that is returned is the size
   Bareos will backup if the sparse option is not specified in the FileSet.
   There is currently no way to get an estimate of the real file size that
   would be found should the sparse option be enabled.

\item [exit]
   \index[general]{Console!Command!exit}
   This command terminates the console program.

\item [export]
   \index[general]{Console!Command!export}
   The export command is used to export tapes from an autochanger. Most Automatic
   Tapechangers offer special slots for importing new tape cartridges or
   exporting written tape cartridges. This can happen without having to set
   the device offline.

   The full form of this command is:

\begin{bconsole}{export}
export storage=<storage-name> srcslots=<slot-selection> [dstslots=<slot-selection> volume=<volume-name> scan]
\end{bconsole}

   The export command does exactly the opposite of the import command. You
   can specify which slots should be transferred to import/export slots. The
   most useful application of the export command is the possibility to
   automatically transfer the volumes of a certain backup into the import/export
   slots for external storage.

   To be able to to this, the export command also accepts a list of volume names
   to be exported.

   Example:

\begin{bconsole}{export volume}
export volume=A00020L4|A00007L4|A00005L4
\end{bconsole}

   Instead of exporting volumes by names you can also select a number of slots via
   the srcslots keyword and export those to the slots you specify in dstslots. The export
   command will check if the slots have content (e.g. otherwise there is not much to
   export) and if there are enough export slots and if those are really import/export slots.

   Example:

\begin{bconsole}{export slots}
export srcslots=1-2 dstslots=37-38
\end{bconsole}

   To automatically export the Volumes used by a certain backup job, you can use the following RunScript in that job:

\begin{bconsole}{automatic export}
RunScript {
    Console = "export storage=TandbergT40 volume=%V"
    RunsWhen = After
    RunsOnClient = no
}
\end{bconsole}

  To send an e-mail notification via the Messages resource regarding export tapes you can use the Variable \%V substitution in the Messages resource, which is implemented in Bareos 13.2. However, it does also work in earlier releases inside the job resources. So in versions prior to Bareos 13.2 the following workaround can be used:

\begin{bconsole}{e-mail notification via messages resource regarding export tapes}
RunAfterJob = "/bin/bash -c \"/bin/echo Remove Tape %V | \
/usr/sbin/bsmtp -h localhost -f root@localhost -s 'Remove Tape %V' root@localhost \""
\end{bconsole}


\item [gui]
   \index[general]{Console!Command!gui}
    Invoke the non-interactive gui mode.
    This command is only used when \command{bconsole} is commanded by an external program.

\item [help]
   \index[general]{Console!Command!help}
   This command displays the list of commands available.

\item [import]
   \index[general]{Console!Command!import}
   The import command is used to import tapes into an autochanger. Most Automatic
   Tapechangers offer special slots for importing new tape cartridges or
   exporting written tape cartridges. This can happen without having to set
   the device offline.

   The full form of this command is:

\begin{bconsole}{import}
import storage=<storage-name> [srcslots=<slot-selection> dstslots=<slot-selection> volume=<volume-name> scan]
\end{bconsole}

   To import new tapes into the autochanger, you only have to load the new
   tapes into the import/export slots and call import from the cmdline.

   The import command will automatically transfer the new tapes into free
   slots of the autochanger. The slots are filled in order of the slot numbers.
   To import all tapes, there have to be enough free slots to load all tapes.

   Example with a Library with 36 Slots and 3 Import/Export Slots:

\begin{bconsole}{import example}
*import storage=TandbergT40
Connecting to Storage daemon TandbergT40 at bareos:9103 ...
3306 Issuing autochanger "slots" command.
Device "Drive-1" has 39 slots.
Connecting to Storage daemon TandbergT40 at bareos:9103 ...
3306 Issuing autochanger "listall" command.
Connecting to Storage daemon TandbergT40 at bareos:9103 ...
3306 Issuing autochanger transfer command.
3308 Successfully transfered volume from slot 37 to 20.
Connecting to Storage daemon TandbergT40 at bareos:9103 ...
3306 Issuing autochanger transfer command.
3308 Successfully transfered volume from slot 38 to 21.
Connecting to Storage daemon TandbergT40 at bareos:9103 ...
3306 Issuing autochanger transfer command.
3308 Successfully transfered volume from slot 39 to 25.
\end{bconsole}

   You can also import certain slots when you don't have enough free slots
   in your autochanger to put all the import/export slots in.

   Example with a Library with 36 Slots and 3 Import/Export Slots importing one slot:

\begin{bconsole}{import example}
*import storage=TandbergT40 srcslots=37 dstslots=20
Connecting to Storage daemon TandbergT40 at bareos:9103 ...
3306 Issuing autochanger "slots" command.
Device "Drive-1" has 39 slots.
Connecting to Storage daemon TandbergT40 at bareos:9103 ...
3306 Issuing autochanger "listall" command.
Connecting to Storage daemon TandbergT40 at bareos:9103 ...
3306 Issuing autochanger transfer command.
3308 Successfully transfered volume from slot 37 to 20.
\end{bconsole}

\item [label]
   \index[general]{Console!Command!label}
   \index[general]{Console!Command!relabel}
   This command is used to label physical volumes.
   The full form of this command is:

\begin{bconsole}{label}
label storage=<storage-name> volume=<volume-name> slot=<slot>
\end{bconsole}

   If you leave out any part, you will be prompted for it.  The media type
   is automatically taken from the Storage resource definition that you
   supply.  Once the necessary information is obtained, the Console program
   contacts the specified Storage daemon and requests that the Volume be
   labeled.  If the Volume labeling is successful, the Console program will
   create a Volume record in the appropriate Pool.

   The Volume name is restricted to letters, numbers, and the special
   characters hyphen ({\bf -}), underscore ({\bf \_}), colon ({\bf :}), and
   period ({\bf .}).  All other characters including a space are invalid.
   This restriction is to ensure good readability of Volume names to reduce
   operator errors.

   Please note, when labeling a blank tape, Bareos will get {\bf read I/O
   error} when it attempts to ensure that the tape is not already labeled.  If
   you wish to avoid getting these messages, please write an EOF mark on
   your tape before attempting to label it:

\footnotesize
\begin{verbatim}
       mt rewind
       mt weof
\end{verbatim}
\normalsize


The label command can fail for a number of reasons:

\begin{enumerate}
\item The Volume name you specify is already in the  Volume database.

\item The Storage daemon has a tape or other Volume already mounted on the
   device, in which case you must {\bf unmount} the device, insert a blank
   tape, then do the {\bf label} command.

\item The Volume in the device is already a Bareos labeled Volume.  (Bareos will
   never relabel a Bareos labeled Volume unless it is recycled and you use the
   {\bf relabel} command).

\item There is no Volume in the drive.
\end{enumerate}

There are two ways to relabel a volume that already has a Bareos label. The
brute  force method is to write an end of file mark on the tape  using the
system {\bf mt} program, something like the  following:

\footnotesize
\begin{verbatim}
       mt -f /dev/st0 rewind
       mt -f /dev/st0 weof
\end{verbatim}
\normalsize

For a disk volume, you would manually delete the Volume.

Then you use the {\bf label} command to add a new label.  However, this could
leave traces of the old volume in the  catalog.

The preferable method to relabel a Volume is to first purge the volume,
either automatically, or explicitly with the  \bcommand{purge}{} command,
then use the \bcommand{relabel}{} command described  below.

If your autochanger has barcode labels, you can label all the Volumes in
your autochanger one after another by using the \bcommand{label}{barcodes}
command.  For each tape in the changer containing a barcode, Bareos will
mount the tape and then label it with the same name as the barcode.  An
appropriate Media record will also be created in the catalog.  Any barcode
that begins with the same characters as specified on the
"CleaningPrefix=xxx" (default is "CLN") directive in the Director's Pool resource, will be
treated as a cleaning tape, and will not be labeled.  However, an entry for
the cleaning tape will be created in the catalog.  For example with:

\begin{bconfig}{Cleaning Tape}
Pool {
    Name ...
    Cleaning Prefix = "CLN"
}
\end{bconfig}

Any slot containing a barcode of CLNxxxx will be treated as a cleaning tape
and will not be mounted.  Note, the full form of the command is:

\begin{bconsole}{label}
label storage=xxx pool=yyy slots=1-5,10 barcodes
\end{bconsole}

\item [list]
   \index[general]{Console!Command!list}
   The list command lists the requested contents of the Catalog.  The
   various fields of each record are listed on a single line.  The various
   forms of the list command are:

\begin{bconsole}{list}
list jobs
list jobid=<id>           (list jobid id)
list ujobid=<unique job name> (list job with unique name)
list job=<job-name>   (list all jobs with "job-name")
list jobname=<job-name>  (same as above)
    In the above, you can add "limit=nn" to limit the output to nn jobs.
list joblog jobid=<id> (list job output if recorded in the catalog)
list jobmedia
list jobmedia jobid=<id>
list jobmedia job=<job-name>
list files jobid=<id>
list files job=<job-name>
list pools
list clients
list jobtotals
list volumes
list volumes jobid=<id>
list volumes pool=<pool-name>
list volumes job=<job-name>
list volume=<volume-name>
list nextvolume job=<job-name>
list nextvol job=<job-name>
list nextvol job=<job-name> days=nnn
\end{bconsole}

   What most of the above commands do should be more or less obvious.  In
   general if you do not specify all the command line arguments, the
   command will prompt you for what is needed.

   The \bcommand{list}{nextvol} command will print the Volume name to be used by
   the specified job.  You should be aware that exactly what Volume will be
   used depends on a lot of factors including the time and what a prior job
   will do.  It may fill a tape that is not full when you issue this
   command.  As a consequence, this command will give you a good estimate
   of what Volume will be used but not a definitive answer.  In addition,
   this command may have certain side effect because it runs through the
   same algorithm as a job, which means it may automatically purge or
   recycle a Volume. By default, the job specified must run within the
   next two days or no volume will be found. You can, however, use the
   {\bf days=nnn} specification to specify up to 50 days. For example,
   if on Friday, you want to see what Volume will be needed on Monday,
   for job MyJob, you would use \bcommand{list}{nextvol job=MyJob days=3}.

   If you wish to add specialized commands that list the contents of the
   catalog, you can do so by adding them to the \file{query.sql} file.
   However, this takes some knowledge of programming SQL. Please see the
   \bcommand{query}{} command below for additional information.  See below for
   listing the full contents of a catalog record with the \bcommand{llist}{}
   command.

   As an example, the command {\bf list pools} might produce  the following
   output:

\begin{bconsole}{list pools}
*<input>list pools</input>
+------+---------+---------+---------+----------+-------------+
| PoId | Name    | NumVols | MaxVols | PoolType | LabelFormat |
+------+---------+---------+---------+----------+-------------+
|    1 | Default |       0 |       0 | Backup   | *           |
|    2 | Recycle |       0 |       8 | Backup   | File        |
+------+---------+---------+---------+----------+-------------+
\end{bconsole}

   As mentioned above, the {\bf list} command lists what is in the
   database.  Some things are put into the database immediately when Bareos
   starts up, but in general, most things are put in only when they are
   first used, which is the case for a Client as with Job records, etc.

   Bareos should create a client record in the database the first time you
   run a job for that client.  Doing a {\bf status} will not cause a
   database record to be created.  The client database record will be
   created whether or not the job fails, but it must at least start.  When
   the Client is actually contacted, additional info from the client will
   be added to the client record (a "uname -a" output).

   If you want to see what Client resources you have available in your conf
   file, you use the Console command {\bf show clients}.

\item [llist]
   \index[general]{Console!Command!llist}
   The llist or "long list" command takes all the same arguments that the
   list command described above does.  The difference is that the llist
   command list the full contents of each database record selected.  It
   does so by listing the various fields of the record vertically, with one
   field per line.  It is possible to produce a very large number of output
   lines with this command.

   If instead of the {\bf list pools} as in the example above, you enter
   {\bf llist pools} you might get the following output:

\begin{bconsole}{llist pools}
*<input>llist pools</input>
          PoolId: 1
            Name: Default
         NumVols: 0
         MaxVols: 0
         UseOnce: 0
      UseCatalog: 1
 AcceptAnyVolume: 1
    VolRetention: 1,296,000
  VolUseDuration: 86,400
      MaxVolJobs: 0
     MaxVolBytes: 0
       AutoPrune: 0
         Recycle: 1
        PoolType: Backup
     LabelFormat: *

          PoolId: 2
            Name: Recycle
         NumVols: 0
         MaxVols: 8
         UseOnce: 0
      UseCatalog: 1
 AcceptAnyVolume: 1
    VolRetention: 3,600
  VolUseDuration: 3,600
      MaxVolJobs: 1
     MaxVolBytes: 0
       AutoPrune: 0
         Recycle: 1
        PoolType: Backup
     LabelFormat: File
\end{bconsole}

\item [messages]
   \index[general]{Console!Command!messages}
   This command causes any pending  console messages to be immediately displayed.

\item [memory]
   \index[general]{Console!Command!memory}
   Print current memory usage.


\item [mount]
   \index[general]{Console!Command!mount}
   The mount command is used to get Bareos to read a volume on a physical
   device.  It is a way to tell Bareos that you have mounted a tape and
   that Bareos should examine the tape.  This command is normally
   used only after there was no Volume in a drive and Bareos requests you to mount a new
   Volume or when you have specifically unmounted a Volume with the \bcommand{unmount}{}
   console command, which causes Bareos to close the drive.  If
   you have an autoloader, the mount command will not cause Bareos to
   operate the autoloader unless you specify a {\bf slot} and possibly a
   {\bf drive}. The various forms of the mount command are:

\begin{bconsole}{mount}
mount storage=<storage-name> [slot=<num>] [drive=<num>]
mount [jobid=<id> | job=<job-name>]
\end{bconsole}

   If you have specified \linkResourceDirectiveValue{Sd}{Device}{Automatic  Mount}{yes},
   under most circumstances, Bareos will automatically access
   the Volume unless you have explicitly \bcommand{unmount}{}ed it in  the Console
   program.

\item [move]
   \index[general]{Console!Command!move}
   The move command allows to move volumes between slots in an autochanger without
   having to leave the bconsole.

   To move a volume from slot 32 to slots 33, use:

\begin{bconsole}{move}
*<input>move storage=TandbergT40 srcslots=32 dstslots=33</input>
Connecting to Storage daemon TandbergT40 at bareos:9103 ...
3306 Issuing autochanger "slots" command.
Device "Drive-1" has 39 slots.
Connecting to Storage daemon TandbergT40 at bareos:9103 ...
3306 Issuing autochanger "listall" command.
Connecting to Storage daemon TandbergT40 at bareos:9103 ...
3306 Issuing autochanger transfer command.
3308 Successfully transfered volume from slot 32 to 33.
\end{bconsole}

\item [prune]
   \index[general]{Console!Command!prune}
   \label{ManualPruning}
   The Prune command allows you to safely remove expired database records from
   Jobs, Volumes and Statistics.  This command works only on the Catalog
   database and does not affect data written to Volumes.  In all cases, the
   Prune command applies a retention period to the specified records.  You can
   Prune expired File entries from Job records; you can Prune expired Job
   records from the database, and you can Prune both expired Job and File
   records from specified Volumes.

\begin{bconsole}{prune}
prune files [client=<client>] [pool=<pool>] [yes] |
      jobs [client=<client>] [pool=<pool>] [jobtype=<jobtype>] [yes] |
      volume [=volume] [pool=<pool>] [yes] |
      stats [yes]
\end{bconsole}

   For a Volume to be pruned, the volume status must be \volumestatus{Full}, \volumestatus{Used} or
   \volumestatus{Append} otherwise the pruning will not take place.

\item [purge]
   \index[general]{Console!Command!purge}
   \label{bcommandPurge}
   The Purge command will delete associated catalog database records from
   Jobs and Volumes without considering the retention period.
   This command can be dangerous because you can delete catalog
   records associated with current backups of files, and we recommend that
   you do not use it unless you know what you are doing.  The permitted
   forms of \bcommand{purge}{} are:

\begin{bconsole}{purge}
purge [files [job=<job> | jobid=<jobid> | client=<client> | volume=<volume>]] |
      [jobs [client=<client> | volume=<volume>]] |
      [volume [=<volume>] [storage=<storage>] [pool=<pool>] [devicetype=<type>] [drive=<drivenum>] [action=<action>]] |
      [quota [client=<client>]]
\end{bconsole}

For the \bcommand{purge}{} command to work on volume catalog database  records the
volume status must be \volumestatus{Append}, \volumestatus{Full}, \volumestatus{Used} or \volumestatus{Error}.

The actual data written to the Volume will be unaffected by this command unless
you are using the \linkResourceDirectiveValue{Dir}{Pool}{Action On Purge}{Truncate} option.

To ask Bareos to truncate your \volumestatus{Purged} volumes, you need to use the
following command in interactive mode:
\begin{bconsole}{purge example}
*<input>purge volume action=truncate storage=File pool=Full</input>
\end{bconsole}

However, normally you should use the \bcommand{purge}{} command only to purge a volume from the catalog
and use the \bcommand{truncate}{} command to truncate the volume on the \bareosSd.

\item [resolve]
   \index[general]{Console!Command!resolve}
    In the configuration files, Addresses can (and normally should) be specified as DNS names.
    As the different components of Bareos will establish network connections to other Bareos components,
    it is important that DNS name resolution works on involved components and delivers the same results.
    The \bcommand{resolve}{} command can be used to test DNS resolution of a given hostname 
    on director, storage daemon or client.

\begin{bconsole}{resolve example}
*<input>resolve www.bareos.com</input>
bareos-dir resolves www.bareos.com to host[ipv4:84.44.166.242]

*<input>resolve client=client1-fd www.bareos.com</input>
client1-fd resolves www.bareos.com to host[ipv4:84.44.166.242]

*<input>resolve storage=File www.bareos.com</input>
bareos-sd resolves www.bareos.com to host[ipv4:84.44.166.242]
\end{bconsole}


\item [query]
   \index[general]{Console!Command!query}
   \label{sec:bcommandQuery}
   This command reads a predefined SQL query from  the query file (the name and
   location of the  query file is defined with the QueryFile resource record in
   the Director's configuration file). You are prompted to select  a query from
   the file, and possibly enter one or more parameters,  then the command is
   submitted to the Catalog database SQL engine.

\item [quit]
   \index[general]{quit}
   This command terminates the console program. The  console program sends the
   {\bf quit} request to the Director  and waits for acknowledgment. If the
   Director is busy doing  a previous command for you that has not terminated, it
   may  take some time. You may quit immediately by issuing the  {\bf .quit}
   command (i.e. quit preceded by a period).

\item [relabel]
   \index[general]{Console!Command!relabel}
   This command is used to label physical volumes.

   The full form of this command is:

\begin{bconsole}{relabel}
relabel storage=<storage-name> oldvolume=<old-volume-name> volume=<new-volume-name> pool=<pool-name> [encrypt]
\end{bconsole}

   If you leave out any part, you will be prompted for it.  In order for
   the Volume (old-volume-name) to be relabeled, it must be in the catalog,
   and the volume status must be marked \volumestatus{Purged} or \volumestatus{Recycle}.
   This happens automatically as a result of applying retention periods or
   you may explicitly purge the volume using the \bcommand{purge}{} command.

   Once the volume is physically relabeled, the old data previously written
   on the Volume is lost and cannot be recovered.

\item [release]
   \index[general]{Console!Command!release}
   This command is used to cause the Storage daemon to release (and rewind) the
   current tape in the drive, and to re-read the Volume label the next time
   the tape is used.

\begin{bconsole}{release}
release storage=<storage-name>
\end{bconsole}

   After a release command, the device is still kept open by Bareos (unless
   \linkResourceDirectiveValue{Sd}{Device}{Always Open}{no}) so it
   cannot be used by another program.  However, with some tape drives, the
   operator can remove the current tape and to insert a different one, and
   when the next Job starts, Bareos will know to re-read the tape label to
   find out what tape is mounted.  If you want to be able to use the drive
   with another program (e.g.  \command{mt}), you must use the \bcommand{unmount}{}
   command to cause Bareos to completely release (close) the device.

\item [reload]
   \index[general]{Console!Command!reload}
   The reload command causes the Director to re-read its configuration
   file and apply the new values. The new values will take effect
   immediately for all new jobs.  However, if you change schedules,
   be aware that the scheduler pre-schedules jobs up to two hours in
   advance, so any changes that are to take place during the next two
   hours may be delayed.  Jobs that have already been scheduled to run
   (i.e. surpassed their requested start time) will continue with the
   old values.  New jobs will use the new values. Each time you issue
   a reload command while jobs are running, the prior config values
   will queued until all jobs that were running before issuing
   the reload terminate, at which time the old config values will
   be released from memory. The Directory permits keeping up to
   ten prior set of configurations before it will refuse a reload
   command. Once at least one old set of config values has been
   released it will again accept new reload commands.

   While it is possible to reload the Director's configuration on the fly,
   even while jobs are executing, this is a complex operation and not
   without side effects.  Accordingly, if you have to reload the Director's
   configuration while Bareos is running, it is advisable to restart the
   Director at the next convenient opportunity.

\item [rerun]
   \index[general]{Console!Command!rerun}
   The rerun command allows you to re-run a Job with exactly the same setting
   as the original Job. In Bareos, the job configuration is often altered by job
   overrides. These overrides alter the configuration of the job just for one job run.
   If because of any reason, a job with overrides fails, it is not easy to restart
   a new job that is exactly configured as the job that failed. The whole job
   configuration is automatically set to the defaults and it is hard to
   configure everything like it was.

   By using the rerun command, it is much easier to rerun a job exactly
   as it was configured. You only have to specify the JobId of the failed job.

\begin{bconsole}{rerun}
rerun jobid=<jobid> since_jobid=<jobid> days=<nr_days> hours=<nr_hours> yes
\end{bconsole}

   You can select the jobid(s) to rerun by using one of the selection criteria. Using jobid= will automatically select all jobs failed after and including the given jobid for rerunning. By using days= or hours=, you can select all failed jobids in the last number of days or number of hours respectively for rerunning.

\item [restore]
   \index[general]{Restore}
   \index[general]{Console!Command!restore}
   \index[general]{Console!File Selection}
   \label{bcommandRestore}
   The restore command allows you to select one or more Jobs (JobIds) to be
   restored using various methods.  Once the JobIds are selected, the File
   records for those Jobs are placed in an internal Bareos directory tree,
   and the restore enters a file selection mode that allows you to
   interactively walk up and down the file tree selecting individual files
   to be restored.  This mode is somewhat similar to the standard Unix {\bf
   restore} program's interactive file selection mode.

\begin{bconsole}{restore}
restore storage=<storage-name> client=<backup-client-name>
  where=<path> pool=<pool-name> fileset=<fileset-name>
  restoreclient=<restore-client-name>
  restorejob=<job-name>
  select current all done
\end{bconsole}

   Where {\bf current}, if specified, tells the restore command to
   automatically select a restore to the most current backup.  If not
   specified, you will be prompted.  The {\bf all} specification tells the
   restore command to restore all files.  If it is not specified, you will
   be prompted for the files to restore.  For details of the {\bf restore}
   command, please see the \ilink{Restore Chapter}{RestoreChapter} of this
   manual.

   The client keyword initially specifies the client from which the backup
   was made and the client to which the restore will be make.  However,
   if the restoreclient keyword is specified, then the restore is written
   to that client.

   The restore job rarely needs to be specified, as bareos installations
   commonly only have a single restore job configured. However, for certain
   cases, such as a varying list of RunScript specifications, multiple
   restore jobs may be configured. The restorejob argument allows the
   selection of one of these jobs.

    For more details, see the \ilink{Restore chapter}{RestoreChapter}.

\item [run]
   \index[general]{Console!Command!run}
   This command allows you to schedule jobs  to be run immediately.

   The full form of the command is:

\begin{bconsole}{run}
run job=<job-name> client=<client-name> fileset=<fileset-name>
   level=<level> storage=<storage-name> where=<directory-prefix>
   when=<universal-time-specification> pool=<pool-name>
   pluginoptions=<plugin-options-string> accurate=<yes|no>
   comment=<text> spooldata=<yes|no> priority=<number>
   jobid=<jobid> catalog=<catalog> migrationjob=<job-name> backupclient=<client-name>
   backupformat=<format> nextpool=<pool-name> since=<universal-time-specification>
   verifyjob=<job-name> verifylist=<verify-list> migrationjob=<complete_name>
   yes
\end{bconsole}

   Any information that is needed but not specified will be listed for
   selection, and before starting the job, you will be prompted to accept,
   reject, or modify the parameters of the job to be run, unless you have
   specified {\bf yes}, in which case the job will be immediately sent to
   the scheduler.

   If you wish to start a job at a later time, you can do so by setting  the When
   time. Use the {\bf mod} option and select {\bf When} (no. 6).  Then enter the
   desired start time in YYYY-MM-DD HH:MM:SS format.

   The spooldata argument of the run command cannot be modified through the menu
   and is only accessible by setting its value on the intial command line. If
   no spooldata flag is set, the job, storage or schedule flag is used.

\item[setbandwidth]
  \index[general]{Console!Command!setbandwidth}
  This command (\sinceVersion{console}{setbandwidth}{12.4.1}) is used to limit the bandwidth of a running job or a client.

\begin{bconsole}{setbandwidth}
setbandwidth limit=<nb> [jobid=<id> | client=<cli>]
\end{bconsole}


\item [setdebug]
   \label{bcommandSetdebug}
   \index[general]{Console!Command!setdebug}
   \index[general]{Debug!setdebug}
   \index[general]{Debug!Windows}
   \index[general]{Windows!Debug}
   This command is used to set the debug level in each  daemon. The form of this
   command is:

\begin{bconsole}{setdebug}
setdebug level=nnn [trace=0/1 client=<client-name> | dir | director | storage=<storage-name> | all]
\end{bconsole}

   Each of the daemons normally has debug compiled into the program, but
   disabled. There are two ways to enable the debug output.

    One is to add the
   {\bf -d nnn} option on the command line when starting the daemon. 
   The {\bf nnn} is the debug level, and generally anything between 50 and 200 is
   reasonable. The higher the number, the more output is produced. The output is
   written to standard output.

   The second way of getting debug output is to dynamically turn it on using the
   Console using the \command{setdebug level=nnn} command.
   If none of the options are given, the command will prompt you. You can
   selectively turn on/off debugging in any or all the daemons (i.e. it is not
   necessary to specify all the components of the above command).

   If trace=1 is set, then tracing will be enabled, and the daemon will be
   placed in trace mode, which means that all debug output as set by the
   debug level will be directed to his trace file in the
   current directory of the daemon.  When tracing, each debug output message is
   appended to the trace file.  You must explicitly delete the file when
   you are done.

\begin{bconsole}{set Director debug level to 100 and get messages written to his trace file}
*<input>setdebug level=100 trace=1 dir</input>
level=100 trace=1 hangup=0 timestamp=0 tracefilename=/var/lib/bareos/bareos-dir.example.com.trace
\end{bconsole}

\item [setip]
   \label{bcommandSetIP}
   \index[general]{Console!Command!setip}
   Sets new client address -- if authorized.

   A console is authorized to use the {\bf SetIP} command only if it has a
   Console resource definition in both the Director and the Console.  In
   addition, if the console name, provided on the {\bf Name =} directive,
   must be the same as a Client name, the user of that console is permitted
   to use the {\bf SetIP} command to change the Address directive in the
   Director's client resource to the IP address of the Console.  This
   permits portables or other machines using DHCP (non-fixed IP addresses)
   to "notify" the Director of their current IP address.

\item [show]
   \index[general]{Console!Command!show}
   The show command will list the Director's resource records as defined in
   the Director's configuration.
   This command is used mainly for debugging purposes by developers.
   The following keywords are accepted on the
   show command line: catalogs, clients, counters, devices, directors,
   filesets, jobs, messages, pools, schedules, storages, all, help.
   Please don't confuse this command
   with the {\bf list}, which displays the contents of the catalog.

\item [sqlquery]
   \index[general]{Console!Command!sqlquery}
   The sqlquery command puts the Console program into SQL query mode where
   each line you enter is concatenated to the previous line until a
   semicolon (;) is seen.  The semicolon terminates the command, which is
   then passed directly to the SQL database engine.  When the output from
   the SQL engine is displayed, the formation of a new SQL command begins.
   To terminate SQL query mode and return to the Console command prompt,
   you enter a period (.) in column 1.

   Using this command, you can query the SQL catalog database directly.
   Note you should really know what you are doing otherwise you could
   damage the catalog database.  See the {\bf query} command below for
   simpler and safer way of entering SQL queries.

   Depending on what database engine you are using (MySQL, PostgreSQL or
   SQLite), you will have somewhat different SQL commands available.  For
   more detailed information, please refer to the MySQL, PostgreSQL or
   SQLite documentation.

\item [status]
   \index[general]{Console!Command!status}

   This command will display the status of all components. For the director, it
   will display the next jobs that are scheduled during the next 24 hours as
   well as the status of currently running jobs. For the Storage Daemon, you
   will have drive status or autochanger content. The File Daemon will give you
   information about current jobs like average speed or file accounting. The
   full form of this command is:

\begin{bconsole}{status}
status [all | dir=<dir-name> | director | scheduler | schedule=<schedule-name> |
        client=<client-name> | storage=<storage-name> slots | subscriptions]
\end{bconsole}

   If you do a {\bf status dir}, the console will list any currently
   running jobs, a summary of all jobs scheduled to be run in the next 24
   hours, and a listing of the last ten terminated jobs with their statuses.
   The scheduled jobs summary will include the Volume name to be used.  You
   should be aware of two things: 1. to obtain the volume name, the code
   goes through the same code that will be used when the job runs, but it
   does not do pruning nor recycling of Volumes; 2.  The Volume listed is
   at best a guess.  The Volume actually used may be different because of
   the time difference (more durations may expire when the job runs) and
   another job could completely fill the Volume requiring a new one.

   In the Running Jobs listing, you may find the following types of
   information:

\begin{bconsole}{}
2507 Catalog MatouVerify.2004-03-13_05.05.02 is waiting execution
5349 Full    CatalogBackup.2004-03-13_01.10.00 is waiting for higher
             priority jobs to finish
5348 Differe Minou.2004-03-13_01.05.09 is waiting on max Storage jobs
5343 Full    Rufus.2004-03-13_01.05.04 is running
\end{bconsole}

   Looking at the above listing from bottom to top, obviously JobId 5343
   (Rufus) is running.  JobId 5348 (Minou) is waiting for JobId 5343 to
   finish because it is using the Storage resource, hence the "waiting on
   max Storage jobs".  JobId 5349 has a lower priority than all the other
   jobs so it is waiting for higher priority jobs to finish, and finally,
   JobId 2507 (MatouVerify) is waiting because only one job can run at a
   time, hence it is simply "waiting execution"

   If you do a {\bf status dir}, it will by default list the first
   occurrence of all jobs that are scheduled today and tomorrow.  If you
   wish to see the jobs that are scheduled in the next three days (e.g.  on
   Friday you want to see the first occurrence of what tapes are scheduled
   to be used on Friday, the weekend, and Monday), you can add the {\bf
   days=3} option.  Note, a {\bf days=0} shows the first occurrence of jobs
   scheduled today only.  If you have multiple run statements, the first
   occurrence of each run statement for the job will be displayed for the
   period specified.

   If your job seems to be blocked, you can get a general idea of the
   problem by doing a {\bf status dir}, but you can most often get a
   much more specific indication of the problem by doing a
   {\bf status storage=xxx}.  For example, on an idle test system, when
   I do {\bf status storage=File}, I get:

\begin{bconsole}{status storage}
*<input>status storage=File</input>
Connecting to Storage daemon File at 192.168.68.112:8103

rufus-sd Version: 1.39.6 (24 March 2006) i686-pc-linux-gnu redhat (Stentz)
Daemon started 26-Mar-06 11:06, 0 Jobs run since started.

Running Jobs:
No Jobs running.
====

Jobs waiting to reserve a drive:
====

Terminated Jobs:
 JobId  Level   Files          Bytes Status   Finished        Name
======================================================================
    59  Full        234      4,417,599 OK       15-Jan-06 11:54 usersave
====

Device status:
Autochanger "DDS-4-changer" with devices:
   "DDS-4" (/dev/nst0)
Device "DDS-4" (/dev/nst0) is mounted with Volume="TestVolume002"
Pool="*unknown*"
    Slot 2 is loaded in drive 0.
    Total Bytes Read=0 Blocks Read=0 Bytes/block=0
    Positioned at File=0 Block=0

Device "File" (/tmp) is not open.
====

In Use Volume status:
====
\end{bconsole}

Now, what this tells me is that no jobs are running and that none of
the devices are in use.  Now, if I {\bf unmount} the autochanger, which
will not be used in this example, and then start a Job that uses the
File device, the job will block.  When I re-issue the status storage
command, I get for the Device status:

\begin{bconsole}{status storage}
*<input>status storage=File</input>
...
Device status:
Autochanger "DDS-4-changer" with devices:
   "DDS-4" (/dev/nst0)
Device "DDS-4" (/dev/nst0) is not open.
    Device is BLOCKED. User unmounted.
    Drive 0 is not loaded.

Device "File" (/tmp) is not open.
    Device is BLOCKED waiting for media.
====
...
\end{bconsole}

Now, here it should be clear that if a job were running that wanted
to use the Autochanger (with two devices), it would block because
the user unmounted the device. The real problem for the Job I started
using the "File" device is that the device is blocked waiting for
media -- that is Bareos needs you to label a Volume.



The command \bcommand{status scheduler}{} (\sinceVersion{console}{status scheduler}{12.4.4}) can be used to check when a certain schedule will trigger.
This gives more information than \bcommand{status director}{}.

Called without parameters, \bcommand{status scheduler}{} shows a preview for all schedules for the next 14 days.
It first shows a list of the known schedules and the jobs that will be triggered by these jobs, and next, a table with date (including weekday), schedule name and applied overrides is displayed:

\begin{bconsole}{status scheduler}
*<input>status scheduler</input>
Scheduler Jobs:

Schedule               Jobs Triggered
===========================================================
WeeklyCycle
                       BackupClient1

WeeklyCycleAfterBackup
                       BackupCatalog

====

Scheduler Preview for 14 days:

Date                  Schedule                Overrides
==============================================================
Di 04-Jun-2013 21:00  WeeklyCycle             Level=Incremental
Di 04-Jun-2013 21:10  WeeklyCycleAfterBackup  Level=Full
Mi 05-Jun-2013 21:00  WeeklyCycle             Level=Incremental
Mi 05-Jun-2013 21:10  WeeklyCycleAfterBackup  Level=Full
Do 06-Jun-2013 21:00  WeeklyCycle             Level=Incremental
Do 06-Jun-2013 21:10  WeeklyCycleAfterBackup  Level=Full
Fr 07-Jun-2013 21:00  WeeklyCycle             Level=Incremental
Fr 07-Jun-2013 21:10  WeeklyCycleAfterBackup  Level=Full
Sa 08-Jun-2013 21:00  WeeklyCycle             Level=Differential
Mo 10-Jun-2013 21:00  WeeklyCycle             Level=Incremental
Mo 10-Jun-2013 21:10  WeeklyCycleAfterBackup  Level=Full
Di 11-Jun-2013 21:00  WeeklyCycle             Level=Incremental
Di 11-Jun-2013 21:10  WeeklyCycleAfterBackup  Level=Full
Mi 12-Jun-2013 21:00  WeeklyCycle             Level=Incremental
Mi 12-Jun-2013 21:10  WeeklyCycleAfterBackup  Level=Full
Do 13-Jun-2013 21:00  WeeklyCycle             Level=Incremental
Do 13-Jun-2013 21:10  WeeklyCycleAfterBackup  Level=Full
Fr 14-Jun-2013 21:00  WeeklyCycle             Level=Incremental
Fr 14-Jun-2013 21:10  WeeklyCycleAfterBackup  Level=Full
Sa 15-Jun-2013 21:00  WeeklyCycle             Level=Differential
Mo 17-Jun-2013 21:00  WeeklyCycle             Level=Incremental
Mo 17-Jun-2013 21:10  WeeklyCycleAfterBackup  Level=Full
====
\end{bconsole}

\bcommand{status}{scheduler} accepts the following parameters:
\begin{description}
    \item[client=clientname] shows only the schedules that affect the given client.
    \item[job=jobname] shows only the schedules that affect the given job.
    \item[schedule=schedulename] shows only the given schedule.
    \item[days=number] of days shows only the number of days in the scheduler preview. Positive numbers show the future, negative numbers show the past. days can be combined with the other selection criteria. days= can be combined with the other selection criteria.
\end{description}

In case you are running a maintained version of Bareos,
the command \bcommand{status}{subscriptions} (\sinceVersion{console}{status subscriptions}{12.4.4}) can help you to keep the overview over the subscriptions
that are used.

To enable this functionality, just add the configuration \linkResourceDirective{Dir}{Director}{Subscriptions} directive
and specify the number of subscribed clients, for example:
\begin{bconfig}{enable subscription check}
Director {
   ...
   Subscriptions = 50
}
\end{bconfig}

Using the console command \bcommand{status}{subscriptions}, the status of
the subscriptions can be checked any time interactively:

\begin{bconsole}{status subscriptions}
*<input>status subscriptions</input>
Ok: available subscriptions: 8 (42/50) (used/total)
\end{bconsole}

Also, the number of subscriptions is checked after every job.
If the number of clients is bigger than the configured limit, a Job warning is
created a message like this:
\begin{bconsole}{subscriptions warning}
JobId 7: Warning: Subscriptions exceeded: (used/total) (51/50)
\end{bconsole}

Please note: Nothing else than the warning is issued, no enforcement on
backup, restore or any other operation will happen.

Setting the value for \linkResourceDirectiveValue{Dir}{Director}{Subscriptions}{0} disables this functionality:
\begin{bconfig}{disable subscription check}
Director {
   ...
   Subscriptions = 0
}
\end{bconfig}

Not configuring the directive at all also disables it, as the default value for the Subscriptions directive is zero.

\item [time]
   \index[general]{Console!Command!time}
   The time command shows the current date, time and weekday.

\item [trace]
   \index[general]{Console!Command!trace}
   Turn on/off trace to file.

\item [truncate]
   \index[general]{Console!Command!truncate}
   \index[general]{Disk!Freeing disk space}
   \index[sd]{Disk!Freeing disk space}
   \label{bcommandTruncate}

    If the status of a volume is \volumestatus{Purged},
    it normally still contains data, even so it can not easily be accessed.

\begin{bconsole}{truncate}
truncate volstatus=Purged [storage=<storage>] [pool=<pool>] [volume=<volume>] [yes]
\end{bconsole}

    When using a disk volume (and other volume types also) the volume file still resides on the \bareosSd.
    If you want to reclaim disk space, you can use the \bcommand{truncate}{volstatus=Purged} command.
    When used on a volume, it rewrites the header and by this frees the rest of the disk space.

    If the volume you want to get rid of has not the \volumestatus{Purged} status,
    you first have to use the \bcommand{prune}{volume} or even the \bcommand{purge}{volume} command
    to free the volume from all remaining jobs.

    This command is available since Bareos \sinceVersion{dir}{truncate command}{16.2.5}.

\item [umount]
   \index[general]{Console!Command!umount}
   Alias for \bcommand{unmount}{}.

\item [unmount]
   \index[general]{Console!Command!unmount}
   This command causes the indicated Bareos Storage  daemon to unmount the
   specified device. The forms of the command  are the same as the mount command:

\begin{bconsole}{unmount}
unmount storage=<storage-name> [drive=<num>]
unmount [jobid=<id> | job=<job-name>]
\end{bconsole}

   Once you unmount a storage device, Bareos will no longer be able to use
   it until you issue a mount command for that device. If Bareos needs to
   access that device, it will block and issue mount requests periodically
   to the operator.

   If the device you are unmounting is an autochanger, it will unload
   the drive you have specified on the command line. If no drive is
   specified, it will assume drive 1.

   In most cases, it is preferable to use the \bcommand{release}{} instead.

\item [update]
   \index[general]{Console!Command!update}
   \label{UpdateCommand}
   This command will update the catalog for either a specific Pool record, a Volume
   record, or the Slots in an  autochanger with barcode capability. In the case
   of updating a  Pool record, the new information will be automatically taken
   from  the corresponding Director's configuration resource record. It  can be
   used to increase the maximum number of volumes permitted or  to set a maximum
   number of volumes. The following main keywords may be specified:

    \begin{itemize}
      \item volume
      \item pool
      \item slots
      \item iobid
      \item stats
    \end{itemize}

In the case of updating a  Volume (\bcommand{update}{volume}),
you will be prompted for which value you
wish to change.  The following Volume parameters may be changed:

\footnotesize
\begin{verbatim}
   Volume Status
   Volume Retention Period
   Volume Use Duration
   Maximum Volume Jobs
   Maximum Volume Files
   Maximum Volume Bytes
   Recycle Flag
   Recycle Pool
   Slot
   InChanger Flag
   Pool
   Volume Files
   Volume from Pool
   All Volumes from Pool
   All Volumes from all Pools
\end{verbatim}
\normalsize

   For slots \bcommand{update}{slots}, Bareos will obtain a list of slots and
   their barcodes from the Storage daemon, and for each barcode found, it
   will automatically update the slot in the catalog Media record to
   correspond to the new value.  This is very useful if you have moved
   cassettes in the magazine, or if you have removed the magazine and
   inserted a different one.  As the slot of each Volume is updated, the
   InChanger flag for that Volume will also be set, and any other Volumes
   in the Pool that were last mounted on the same Storage device
   will have their InChanger flag turned off.  This permits
   Bareos to know what magazine (tape holder) is currently in the
   autochanger.

   If you do not have barcodes, you can accomplish the same thing
   by using the \bcommand{update}{slots scan} command.
   The \parameter{scan} keyword tells Bareos to physically mount each tape and to
   read its VolumeName.

   For Pool \bcommand{update}{pool}, Bareos will move the Volume record from its
   existing pool to the pool specified.

   For {\bf Volume from Pool}, {\bf All Volumes from Pool} and {\bf All Volumes
     from all Pools}, the following values are updated from the Pool record:
   Recycle, RecyclePool, VolRetention, VolUseDuration, MaxVolJobs, MaxVolFiles,
   and MaxVolBytes.

   For updating the statistics, use \bcommand{updates}{stats}, see \nameref{sec:JobStatistics}.

   The full form of the update command with all command line arguments is:

\begin{bconsole}{update}
update  volume=<volume-name> [volstatus=<status>]
        [volretention=<time-def>] [pool=<pool-name>]
        [recycle=<yes/no>] [slot=<number>] [inchanger=<yes/no>] |
        pool=<pool-name> [maxvolbytes=<size>] [maxvolfiles=<nb>]
        [maxvoljobs=<nb>][enabled=<yes/no>] [recyclepool=<pool-name>]
        [actiononpurge=<action>] |
        slots [storage=<storage-name>] [scan] |
        jobid=<jobid> [jobname=<name>] [starttime=<time-def>]
        [client=<client-name>] [filesetid=<fileset-id>]
        [jobtype=<job-type>] |
        stats [days=<number>]
\end{bconsole}


\item [use]
   \index[general]{Console!Command!use}
   This command allows you to specify which Catalog  database to use. Normally,
   you will be using only one database so  this will be done automatically. In
   the case that you are using  more than one database, you can use this command
   to switch from  one to another.

\begin{bconsole}{use}
use [catalog=<catalog>]
\end{bconsole}

\item [var]
   \label{var}
   \index[general]{Console!Command!var}
   This command takes a string or quoted string and does variable expansion on
   it mostly the same way variable expansion is done on the \linkResourceDirective{Dir}{Pool}{Label Format} string.
   The difference  between the \bcommand{var}{} command and the actual \linkResourceDirective{Dir}{Pool}{Label Format} process
   is that during the var command, no job is running so dummy values are
   used in place of Job specific variables.

\item [version]
   \index[general]{Console!Command!version}
   The command prints the Director's version.

\item [wait]
   \index[general]{Console!Command!wait}
   The wait command causes the Director to pause  until there are no jobs
   running. This command is useful in  a batch situation such as regression
   testing where you  wish to start a job and wait until that job completes
   before continuing. This command now has the following options:

\begin{bconsole}{wait}
wait [jobid=<jobid>] [jobuid=<unique id>] [job=<job name>]
\end{bconsole}

   If specified with a specific JobId, ... the wait command will wait
   for that particular job to terminate before continuing.

\end{description}

\subsection{Special dot (.) Commands}
\label{dotcommands}
\index[general]{Console!Command!. commands}

There is a list of commands that are prefixed with a period (.). These
commands are intended to be used either by batch programs or graphical user
interface front-ends. They are not normally used by interactive users.
For details, see \bareosDeveloperGuideDotCommands.


\subsection{Special At (@) Commands}
\label{atcommands}

Normally, all commands entered to the Console program are immediately
forwarded to the Director, which may be on another machine, to be executed.
However, there is a small list of {\bf at} commands, all beginning with an at
character (@), that will not be sent to the Director, but rather interpreted
by the Console program directly. Note, these commands are implemented only in
the TTY console program and not in the Bat Console. These commands are:

\begin{description}

\item [@input {\textless}filename{\textgreater}]
   \index[general]{Console!Command!\at{}input {\textless}filename{\textgreater}}
   Read and execute the commands  contained in the file specified.

\item [@output {\textless}filename{\textgreater} {\textless}w{\textbar}a{\textgreater}]
   \index[general]{Console!Command!\at{}output {\textless}filename{\textgreater} {\textless}w{\textbar}a{\textgreater}}
   Send all following output to the  filename specified either overwriting the
file (w) or appending to  the file (a). To redirect the output to the
terminal, simply enter  {\bf @output} without a filename specification.
WARNING: be careful  not to overwrite a valid file. A typical example during a
regression  test might be:

\footnotesize
\begin{verbatim}
    @output /dev/null
    commands ...
    @output
\end{verbatim}
\normalsize

\item [@tee {\textless}filename{\textgreater} {\textless}w{\textbar}a{\textgreater}]
   \index[general]{Console!Command!\at{}tee {\textless}filename{\textgreater} {\textless}w{\textbar}a{\textgreater}}
   Send all subsequent output to  both the specified file and the terminal. It is
   turned off by  specifying {\bf @tee} or {\bf @output} without a filename.

\item [@sleep {\textless}seconds{\textgreater}]
   \index[general]{Console!Command!\at{}sleep {\textless}seconds{\textgreater}}
   Sleep the specified number of seconds.

\item [@time]
   \index[general]{Console!Command!\at{}time}
   Print the current time and date.

\item [@version]
   \index[general]{Console!Command!\at{}version}
   Print the console's version.

\item [@quit]
   \index[general]{Console!Command!\at{}quit}
   quit

\item [@exit]
   \index[general]{Console!Command!\at{}exit}
   quit

\item [@\# anything]
   \index[general]{Console!Command!\at{}\# anything}
   Comment

\item [@help]
   \index[general]{Console!Command!\at{}help}
   Get the list of every special @ commands.

\item [@separator {\textless}char{\textgreater}]
\index[general]{Console!Command!\at{}separator}
  When using bconsole with readline, you can set the command separator to one
  of those characters to write commands who require multiple input on one line,
  or to put multiple commands on a single line.
\begin{verbatim}
  !$%&'()*+,-/:;<>?[]^`{|}~
\end{verbatim}

  Note, if you use a semicolon (;) as a separator character, which is
  common, you will not be able to use the {\bf sql} command, which
  requires each command to be terminated by a semicolon.

\end{description}


\section{Adding Volumes to a Pool}
\index[general]{Console!Adding a Volume to a Pool}

\TODO{move to another chapter}

If you have used the {\bf label} command to label a Volume, it will be
automatically added to the Pool, and you will not need to add any media to the
pool.

Alternatively, you may choose to add a number of Volumes to the pool without
labeling them. At a later time when the Volume is requested by {\bf Bareos}
you will need to label it.

Before adding a volume, you must know the following information:

\begin{enumerate}
\item The name of the Pool (normally "Default")
\item The Media Type as specified in the Storage Resource  in the Director's
   configuration file (e.g. "DLT8000")
\item The number and names of the Volumes you wish to create.
\end{enumerate}

For example, to add media to a Pool, you would issue the following commands to
the console program:

\footnotesize
\begin{verbatim}
*add
Enter name of Pool to add Volumes to: Default
Enter the Media Type: DLT8000
Enter number of Media volumes to create. Max=1000: 10
Enter base volume name: Save
Enter the starting number: 1
10 Volumes created in pool Default
*
\end{verbatim}
\normalsize

To see what you have added, enter:

\footnotesize
\begin{verbatim}
*list media pool=Default
+-------+----------+---------+---------+-------+------------------+
| MedId | VolumeNa | MediaTyp| VolStat | Bytes | LastWritten      |
+-------+----------+---------+---------+-------+------------------+
|    11 | Save0001 | DLT8000 | Append  |     0 | 0000-00-00 00:00 |
|    12 | Save0002 | DLT8000 | Append  |     0 | 0000-00-00 00:00 |
|    13 | Save0003 | DLT8000 | Append  |     0 | 0000-00-00 00:00 |
|    14 | Save0004 | DLT8000 | Append  |     0 | 0000-00-00 00:00 |
|    15 | Save0005 | DLT8000 | Append  |     0 | 0000-00-00 00:00 |
|    16 | Save0006 | DLT8000 | Append  |     0 | 0000-00-00 00:00 |
|    17 | Save0007 | DLT8000 | Append  |     0 | 0000-00-00 00:00 |
|    18 | Save0008 | DLT8000 | Append  |     0 | 0000-00-00 00:00 |
|    19 | Save0009 | DLT8000 | Append  |     0 | 0000-00-00 00:00 |
|    20 | Save0010 | DLT8000 | Append  |     0 | 0000-00-00 00:00 |
+-------+----------+---------+---------+-------+------------------+
*
\end{verbatim}
\normalsize

Notice that the console program automatically appended a number to the base
Volume name that you specify (Save in this case). If you don't want it to
append a number, you can simply answer 0 (zero) to the question "Enter number
of Media volumes to create. Max=1000:", and in this case, it will create a
single Volume with the exact name you specify.