" -b bootstrap specify a bootstrap file\n"
" -c <file> specify configuration file\n"
" -d <nn> set debug level to nn\n"
-" -v verbose\n"
" -i specify input Volume names (separated by |)\n"
" -o specify output Volume names (separated by |)\n"
+" -p proceed inspite of errors\n"
+" -v verbose\n"
" -w <dir> specify working directory (default /tmp)\n"
" -? print this message\n\n"));
exit(1);
int ch;
char *iVolumeName = NULL;
char *oVolumeName = NULL;
+ bool ignore_label_errors = false;
- my_name_is(argc, argv, "bscan");
+ my_name_is(argc, argv, "bcopy");
init_msg(NULL, NULL);
- while ((ch = getopt(argc, argv, "b:c:d:mn:p:rsu:vV:w:?")) != -1) {
+ while ((ch = getopt(argc, argv, "b:c:d:i:o:pvw:?")) != -1) {
switch (ch) {
case 'b':
bsr = parse_bsr(NULL, optarg);
debug_level = 1;
break;
- case 'v':
- verbose++;
- break;
-
case 'i': /* input Volume name */
iVolumeName = optarg;
break;
oVolumeName = optarg;
break;
+ case 'p':
+ ignore_label_errors = true;
+ break;
+
+ case 'v':
+ verbose++;
+ break;
case 'w':
wd = optarg;
/* Setup and acquire input device for reading */
in_jcr = setup_jcr("bcopy", argv[0], bsr, iVolumeName);
+ in_jcr->ignore_label_errors = ignore_label_errors;
in_dev = setup_to_access_device(in_jcr, 1); /* read device */
if (!in_dev) {
exit(1);
}
-
+/*
+ * read_records() calls back here for each record it gets
+ */
static int record_cb(JCR *in_jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
{
if (list_records) {
int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
{
- fprintf(stderr, "Mount Volume %s on device %s and press return when ready: ",
+ fprintf(stderr, "Mount Volume \"%s\" on device \"%s\" and press return when ready: ",
in_jcr->VolumeName, dev_name(dev));
getchar();
return 1;
--- /dev/null
+#!/bin/sh
+#
+# Shell script to update MySQL tables from version 1.32 to 1.33
+#
+echo " "
+echo "This script will update a bacula database from version 6 to 7."
+echo "Depending on the size of your database,"
+echo "this script may take several minutes to run."
+echo " "
+
+# the location of the mysql program
+bindir=/usr/bin
+
+if $bindir/mysql $* -f <<END-OF-DATA
+USE bacula;
+
+ALTER TABLE Media ADD COLUMN InChanger TINYINT NOT NULL DEFAULT 0;
+ALTER TABLE Media ADD COLUMN MediaAddressing TINYINT NOT NULL DEFAULT 0;
+ALTER TABLE Media ADD COLUMN VolReadTime BIGINT UNSIGNED NOT NULL DEFAULT 0;
+ALTER TABLE Media ADD COLUMN VolWriteTime BIGINT UNSIGNED NOT NULL DEFAULT 0;
+
+ALTER TABLE Pool ADD COLUMN Enabled TINYINT DEFAULT 1;
+ALTER TABLE Pool ADD COLUMN ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool;
+ALTER TABLE Pool ADD COLUMN RecyclePoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool;
+
+DROP TABLE BaseFiles;
+
+
+CREATE TABLE BaseFiles (
+ BaseId INTEGER UNSIGNED AUTO_INCREMENT,
+ JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
+ FileId INTEGER UNSIGNED NOT NULL REFERENCES File,
+ FileIndex INTEGER UNSIGNED,
+ PRIMARY KEY(BaseId)
+ );
+
+DROP TABLE UnsavedFiles;
+
+CREATE TABLE UnsavedFiles (
+ UnsavedId INTEGER UNSIGNED AUTO_INCREMENT,
+ JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
+ PathId INTEGER UNSIGNED NOT NULL REFERENCES Path,
+ FilenameId INTEGER UNSIGNED NOT NULL REFERENCES Filename,
+ PRIMARY KEY (UnsavedId)
+ );
+
+DROP TABLE BaseFiles;
+
+CREATE TABLE BaseFiles (
+ BaseId INTEGER UNSIGNED AUTO_INCREMENT,
+ BaseJobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
+ JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
+ FileId INTEGER UNSIGNED NOT NULL REFERENCES File,
+ FileIndex INTEGER UNSIGNED,
+ PRIMARY KEY(BaseId)
+ );
+
+DELETE FROM Version;
+INSERT INTO Version (VersionId) VALUES (7);
+
+END-OF-DATA
+then
+ echo "Update of Bacula MySQL tables succeeded."
+else
+ echo "Update of Bacula MySQL tables failed."
+fi
+exit 0
--- /dev/null
+#!/bin/sh
+#
+# shell script to update SQLite from version 1.32 to 1.33
+#
+echo " "
+echo "This script will update a bacula database from version 6 to 7."
+echo "Depending on the size of your database,"
+echo "this script may take several minutes to run."
+echo " "
+
+# The location of the sqlite program
+bindir=/usr/lib/sqlite
+# The location of your bacula working directory
+cd /var/bacula
+
+$bindir/sqlite $* bacula.db <<END-OF-DATA
+
+BEGIN TRANSACTION;
+CREATE TEMPORARY TABLE Media_backup (
+ MediaId INTEGER UNSIGNED AUTOINCREMENT,
+ VolumeName VARCHAR(128) NOT NULL,
+ Slot INTEGER DEFAULT 0,
+ PoolId INTEGER UNSIGNED REFERENCES Pool NOT NULL,
+ MediaType VARCHAR(128) NOT NULL,
+ FirstWritten DATETIME DEFAULT 0,
+ LastWritten DATETIME DEFAULT 0,
+ LabelDate DATETIME DEFAULT 0,
+ VolJobs INTEGER UNSIGNED DEFAULT 0,
+ VolFiles INTEGER UNSIGNED DEFAULT 0,
+ VolBlocks INTEGER UNSIGNED DEFAULT 0,
+ VolMounts INTEGER UNSIGNED DEFAULT 0,
+ VolBytes BIGINT UNSIGNED DEFAULT 0,
+ VolErrors INTEGER UNSIGNED DEFAULT 0,
+ VolWrites INTEGER UNSIGNED DEFAULT 0,
+ VolCapacityBytes BIGINT UNSIGNED DEFAULT 0,
+ VolStatus VARCHAR(20) NOT NULL,
+ Recycle TINYINT DEFAULT 0,
+ VolRetention BIGINT UNSIGNED DEFAULT 0,
+ VolUseDuration BIGINT UNSIGNED DEFAULT 0,
+ MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
+ MaxVolFiles INTEGER UNSIGNED DEFAULT 0,
+ MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
+ InChanger TINYINT DEFAULT 0,
+ MediaAddressing TINYINT DEFAULT 0,
+ VolReadTime BIGINT UNSIGNED DEFAULT 0,
+ VolWriteTime BIGINT UNSIGNED DEFAULT 0,
+ PRIMARY KEY(MediaId)
+ );
+
+INSERT INTO Media_backup SELECT
+ MediaId, VolumeName, Slot, PoolId,
+ MediaType, FirstWritten, LastWritten,
+ LabelDate, VolJobs, VolFiles, VolBlocks,
+ VolMounts, VolBytes, VolErrors, VolWrites,
+ VolCapacityBytes, VolStatus, Recycle,
+ VolRetention, VolUseDuration, MaxVolJobs,
+ MaxVolFiles, MaxVolBytes, 0, 0, 0, 0
+ FROM Media;
+
+
+DROP TABLE Media;
+
+CREATE TABLE Media (
+ MediaId INTEGER UNSIGNED AUTOINCREMENT,
+ VolumeName VARCHAR(128) NOT NULL,
+ Slot INTEGER DEFAULT 0,
+ PoolId INTEGER UNSIGNED REFERENCES Pool NOT NULL,
+ MediaType VARCHAR(128) NOT NULL,
+ FirstWritten DATETIME DEFAULT 0,
+ LastWritten DATETIME DEFAULT 0,
+ LabelDate DATETIME DEFAULT 0,
+ VolJobs INTEGER UNSIGNED DEFAULT 0,
+ VolFiles INTEGER UNSIGNED DEFAULT 0,
+ VolBlocks INTEGER UNSIGNED DEFAULT 0,
+ VolMounts INTEGER UNSIGNED DEFAULT 0,
+ VolBytes BIGINT UNSIGNED DEFAULT 0,
+ VolErrors INTEGER UNSIGNED DEFAULT 0,
+ VolWrites INTEGER UNSIGNED DEFAULT 0,
+ VolCapacityBytes BIGINT UNSIGNED DEFAULT 0,
+ VolStatus VARCHAR(20) NOT NULL,
+ Recycle TINYINT DEFAULT 0,
+ VolRetention BIGINT UNSIGNED DEFAULT 0,
+ VolUseDuration BIGINT UNSIGNED DEFAULT 0,
+ MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
+ MaxVolFiles INTEGER UNSIGNED DEFAULT 0,
+ MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
+ InChanger TINYINT DEFAULT 0,
+ MediaAddressing TINYINT DEFAULT 0,
+ VolReadTime BIGINT UNSIGNED DEFAULT 0,
+ VolWriteTime BIGINT UNSIGNED DEFAULT 0,
+ PRIMARY KEY(MediaId)
+ );
+
+INSERT INTO Media (
+ MediaId, VolumeName, Slot, PoolId,
+ MediaType, FirstWritten, LastWritten,
+ LabelDate, VolJobs, VolFiles, VolBlocks,
+ VolMounts, VolBytes, VolErrors, VolWrites,
+ VolCapacityBytes, VolStatus, Recycle,
+ VolRetention, VolUseDuration, MaxVolJobs,
+ MaxVolFiles, MaxVolBytes,
+ InChanger, MediaAddressing,
+ VolReadTime, VolWriteTime,
+ SELECT * FROM Media_backup;
+
+DROP TABLE Media_backup;
+
+CREATE INDEX inx8 ON Media (PoolId);
+
+CREATE TABLE Pool_backup (
+ PoolId INTEGER UNSIGNED AUTOINCREMENT,
+ Name VARCHAR(128) NOT NULL,
+ NumVols INTEGER UNSIGNED DEFAULT 0,
+ MaxVols INTEGER UNSIGNED DEFAULT 0,
+ UseOnce TINYINT DEFAULT 0,
+ UseCatalog TINYINT DEFAULT 1,
+ AcceptAnyVolume TINYINT DEFAULT 0,
+ VolRetention BIGINT UNSIGNED DEFAULT 0,
+ VolUseDuration BIGINT UNSIGNED DEFAULT 0,
+ MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
+ MaxVolFiles INTEGER UNSIGNED DEFAULT 0,
+ MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
+ AutoPrune TINYINT DEFAULT 0,
+ Recycle TINYINT DEFAULT 0,
+ PoolType VARCHAR(20) NOT NULL,
+ LabelFormat VARCHAR(128) NOT NULL,
+ Enabled TINYINT DEFAULT 1,
+ ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ UNIQUE (Name),
+ PRIMARY KEY (PoolId)
+ );
+
+INSERT INTO Pool_backup SELECT
+ PoolId,
+ Name,
+ NumVols,
+ MaxVols,
+ UseOnce,
+ UseCatalog,
+ AcceptAnyVolume,
+ VolRetention,
+ VolUseDuration,
+ MaxVolJobs,
+ MaxVolFiles,
+ MaxVolBytes,
+ AutoPrune,
+ Recycle,
+ PoolType,
+ LabelFormat, 1, 0, 0
+ FROM Pool;
+
+DROP TABLE Pool;
+
+CREATE TABLE Pool (
+ PoolId INTEGER UNSIGNED AUTOINCREMENT,
+ Name VARCHAR(128) NOT NULL,
+ NumVols INTEGER UNSIGNED DEFAULT 0,
+ MaxVols INTEGER UNSIGNED DEFAULT 0,
+ UseOnce TINYINT DEFAULT 0,
+ UseCatalog TINYINT DEFAULT 1,
+ AcceptAnyVolume TINYINT DEFAULT 0,
+ VolRetention BIGINT UNSIGNED DEFAULT 0,
+ VolUseDuration BIGINT UNSIGNED DEFAULT 0,
+ MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
+ MaxVolFiles INTEGER UNSIGNED DEFAULT 0,
+ MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
+ AutoPrune TINYINT DEFAULT 0,
+ Recycle TINYINT DEFAULT 0,
+ PoolType VARCHAR(20) NOT NULL,
+ LabelFormat VARCHAR(128) NOT NULL,
+ Enabled TINYINT DEFAULT 1,
+ ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ UNIQUE (Name),
+ PRIMARY KEY (PoolId)
+ );
+
+INSERT INTO Pool (
+ PoolId,
+ Name,
+ NumVols,
+ MaxVols,
+ UseOnce,
+ UseCatalog,
+ AcceptAnyVolume,
+ VolRetention,
+ VolUseDuration,
+ MaxVolJobs,
+ MaxVolFiles,
+ MaxVolBytes,
+ AutoPrune,
+ Recycle,
+ PoolType,
+ LabelFormat, Enabled, ScratchPoolId, RecyclePoolId)
+ SELECT * FROM Pool_backup;
+
+DROP TABLE Pool_backup;
+
+
+DROP TABLE BaseFiles;
+
+CREATE TABLE BaseFiles (
+ BaseId INTEGER UNSIGNED AUTOINCREMENT,
+ BaseJobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
+ JobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
+ FileId INTEGER UNSIGNED REFERENCES File NOT NULL,
+ FileIndex INTEGER UNSIGNED,
+ PRIMARY KEY(BaseId)
+ );
+
+COMMIT;
+
+DELETE FROM Version;
+INSERT INTO Version (VersionId) VALUES (7);
+
+END-OF-DATA