From 7c322dd9de749da65565d7d2a8d30c64c6af6d9e Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 1 Apr 2007 09:44:32 +0000 Subject: [PATCH] kes Modify job report to include director name and Build OS. kes Move drop and check_catalog() before fork. kes Add update database scripts (version 9 to 10) to updatedb directory git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4485 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/kernstodo | 9 + bacula/src/cats/mysql.c | 2 +- bacula/src/dird/backup.c | 7 +- bacula/src/dird/dird.c | 14 +- bacula/src/dird/migrate.c | 7 +- bacula/src/dird/restore.c | 7 +- bacula/src/dird/verify.c | 13 +- bacula/technotes-2.1 | 15 +- bacula/updatedb/update_bdb_tables_9_to_10 | 9 + bacula/updatedb/update_mysql_tables_9_to_10 | 76 ++++++ .../updatedb/update_postgresql_tables_9_to_10 | 83 ++++++ bacula/updatedb/update_sqlite3_tables_9_to_10 | 251 ++++++++++++++++++ bacula/updatedb/update_sqlite_tables_9_to_10 | 251 ++++++++++++++++++ 13 files changed, 718 insertions(+), 26 deletions(-) create mode 100755 bacula/updatedb/update_bdb_tables_9_to_10 create mode 100755 bacula/updatedb/update_mysql_tables_9_to_10 create mode 100755 bacula/updatedb/update_postgresql_tables_9_to_10 create mode 100755 bacula/updatedb/update_sqlite3_tables_9_to_10 create mode 100755 bacula/updatedb/update_sqlite_tables_9_to_10 diff --git a/bacula/kernstodo b/bacula/kernstodo index 684690b579..df9222511e 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -43,6 +43,15 @@ Document: Priority: +01-Apr 00:42 rufus-dir: Start Backup JobId 55, Job=kernsave.2007-04-01_00.42.48 +01-Apr 00:42 rufus-sd: Python SD JobStart: JobId=55 Client=Rufus +01-Apr 00:42 rufus-dir: Created new Volume "Full0001" in catalog. +01-Apr 00:42 rufus-dir: Using Device "File" +01-Apr 00:42 rufus-sd: kernsave.2007-04-01_00.42.48 Warning: Device "File" (/tmp) not configured to autolabel Volumes. +01-Apr 00:42 rufus-sd: kernsave.2007-04-01_00.42.48 Warning: Device "File" (/tmp) not configured to autolabel Volumes. +01-Apr 00:42 rufus-sd: Please mount Volume "Full0001" on Storage Device "File" (/tmp) for Job kernsave.2007-04-01_00.42.48 +01-Apr 00:44 rufus-sd: Wrote label to prelabeled Volume "Full0001" on device "File" (/tmp) + - Add Where: client:/.... to restore job report. - Ensure that each device in an Autochanger has a different Device Index. diff --git a/bacula/src/cats/mysql.c b/bacula/src/cats/mysql.c index 9979157cf2..6af54383a3 100644 --- a/bacula/src/cats/mysql.c +++ b/bacula/src/cats/mysql.c @@ -185,7 +185,7 @@ db_open_database(JCR *jcr, B_DB *mdb) if (mdb->db == NULL) { Mmsg2(&mdb->errmsg, _("Unable to connect to MySQL server.\n" "Database=%s User=%s\n" -"It MySQL server not running or your password is incorrect.\n"), +"MySQL connect failed either server not running or your authorization is incorrect.\n"), mdb->db_name, mdb->db_user); V(mutex); return 0; diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index 42eb46b169..233074af87 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -438,7 +438,8 @@ void backup_cleanup(JCR *jcr, int TermCode) // bmicrosleep(15, 0); /* for debugging SIGHUP */ - Jmsg(jcr, msg_type, 0, _("Bacula %s %s (%s) %s %s %s at %s\n" + Jmsg(jcr, msg_type, 0, _("Bacula %s %s (%s): %s\n" +" Build OS: %s %s %s\n" " JobId: %d\n" " Job: %s\n" " Backup Level: %s%s\n" @@ -468,8 +469,8 @@ void backup_cleanup(JCR *jcr, int TermCode) " FD termination status: %s\n" " SD termination status: %s\n" " Termination: %s\n\n"), - my_name, VERSION, BDATE, HOST_OS, DISTNAME, DISTVER, - edt, + my_name, VERSION, LSMDATE, edt, + HOST_OS, DISTNAME, DISTVER, jcr->jr.JobId, jcr->jr.Job, level_to_str(jcr->JobLevel), jcr->since, diff --git a/bacula/src/dird/dird.c b/bacula/src/dird/dird.c index 4f2e337100..e1c1bd1c5c 100644 --- a/bacula/src/dird/dird.c +++ b/bacula/src/dird/dird.c @@ -226,6 +226,12 @@ int main (int argc, char *argv[]) Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile); } + drop(uid, gid); /* reduce privileges if requested */ + + if (!check_catalog()) { + Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile); + } + if (test_config) { terminate_dird(0); } @@ -248,11 +254,6 @@ int main (int argc, char *argv[]) create_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs)); read_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs)); - drop(uid, gid); /* reduce privileges if requested */ - - if (!check_catalog()) { - Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile); - } #if !defined(HAVE_WIN32) signal(SIGHUP, reload_config); @@ -858,10 +859,13 @@ static bool check_catalog() catalog->db_port, catalog->db_socket, catalog->mult_db_connections); if (!db || !db_open_database(NULL, db)) { + Pmsg2(000, _("Could not open Catalog \"%s\", database \"%s\".\n"), + catalog->name(), catalog->db_name); Jmsg(NULL, M_FATAL, 0, _("Could not open Catalog \"%s\", database \"%s\".\n"), catalog->name(), catalog->db_name); if (db) { Jmsg(NULL, M_FATAL, 0, _("%s"), db_strerror(db)); + Pmsg1(000, "%s", db_strerror(db)); } OK = false; continue; diff --git a/bacula/src/dird/migrate.c b/bacula/src/dird/migrate.c index cb37dad38a..b45c9876b3 100644 --- a/bacula/src/dird/migrate.c +++ b/bacula/src/dird/migrate.c @@ -1152,7 +1152,8 @@ void migration_cleanup(JCR *jcr, int TermCode) jobstatus_to_ascii(jcr->SDJobStatus, sd_term_msg, sizeof(sd_term_msg)); - Jmsg(jcr, msg_type, 0, _("Bacula %s %s (%s) %s %s %s at %s\n" + Jmsg(jcr, msg_type, 0, _("Bacula %s %s (%s): %s\n" +" Build OS: %s %s %s\n" " Prev Backup JobId: %s\n" " New Backup JobId: %s\n" " Migration JobId: %s\n" @@ -1178,8 +1179,8 @@ void migration_cleanup(JCR *jcr, int TermCode) " SD Errors: %d\n" " SD termination status: %s\n" " Termination: %s\n\n"), - my_name, VERSION, BDATE, HOST_OS, DISTNAME, DISTVER, - edt, + my_name, VERSION, LSMDATE, edt, + HOST_OS, DISTNAME, DISTVER, edit_uint64(jcr->previous_jr.JobId, ec6), mig_jcr ? edit_uint64(mig_jcr->jr.JobId, ec7) : "0", edit_uint64(jcr->jr.JobId, ec8), diff --git a/bacula/src/dird/restore.c b/bacula/src/dird/restore.c index 7fad180885..186e665580 100644 --- a/bacula/src/dird/restore.c +++ b/bacula/src/dird/restore.c @@ -280,7 +280,8 @@ void restore_cleanup(JCR *jcr, int TermCode) jobstatus_to_ascii(jcr->FDJobStatus, fd_term_msg, sizeof(fd_term_msg)); jobstatus_to_ascii(jcr->SDJobStatus, sd_term_msg, sizeof(sd_term_msg)); - Jmsg(jcr, msg_type, 0, _("Bacula %s %s (%s) %s %s %s at %s\n" + Jmsg(jcr, msg_type, 0, _("Bacula %s %s (%s): %s\n" +" Build OS: %s %s %s\n" " JobId: %d\n" " Job: %s\n" " Client: %s\n" @@ -294,8 +295,8 @@ void restore_cleanup(JCR *jcr, int TermCode) " FD termination status: %s\n" " SD termination status: %s\n" " Termination: %s\n\n"), - my_name, VERSION, BDATE, HOST_OS, DISTNAME, DISTVER, - edt, + my_name, VERSION, LSMDATE, edt, + HOST_OS, DISTNAME, DISTVER, jcr->jr.JobId, jcr->jr.Job, jcr->client->hdr.name, diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index 18dc5d8cc2..768343c98c 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -412,7 +412,8 @@ void verify_cleanup(JCR *jcr, int TermCode) jobstatus_to_ascii(jcr->FDJobStatus, fd_term_msg, sizeof(fd_term_msg)); if (jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG) { jobstatus_to_ascii(jcr->SDJobStatus, sd_term_msg, sizeof(sd_term_msg)); - Jmsg(jcr, msg_type, 0, _("Bacula %s %s (%s) %s %s %s at %s\n" + Jmsg(jcr, msg_type, 0, _("Bacula %s %s (%s): %s\n" +" Build OS: %s %s %s\n" " JobId: %d\n" " Job: %s\n" " FileSet: %s\n" @@ -428,8 +429,8 @@ void verify_cleanup(JCR *jcr, int TermCode) " FD termination status: %s\n" " SD termination status: %s\n" " Termination: %s\n\n"), - my_name, VERSION, BDATE, HOST_OS, DISTNAME, DISTVER, - edt, + my_name, VERSION, LSMDATE, edt, + HOST_OS, DISTNAME, DISTVER, jcr->jr.JobId, jcr->jr.Job, jcr->fileset->hdr.name, @@ -446,7 +447,8 @@ void verify_cleanup(JCR *jcr, int TermCode) sd_term_msg, term_msg); } else { - Jmsg(jcr, msg_type, 0, _("Bacula %s Version: %s (%s) %s %s %s\n" + Jmsg(jcr, msg_type, 0, _("Bacula %s %s (%s): %s\n" +" Build: %s %s %s\n" " JobId: %d\n" " Job: %s\n" " FileSet: %s\n" @@ -460,7 +462,8 @@ void verify_cleanup(JCR *jcr, int TermCode) " Non-fatal FD errors: %d\n" " FD termination status: %s\n" " Termination: %s\n\n"), - my_name, VERSION, BDATE, HOST_OS, DISTNAME, DISTVER, + my_name, VERSION, BDATE, edt, + HOST_OS, DISTNAME, DISTVER, edt, jcr->jr.JobId, jcr->jr.Job, diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index 60e41dab84..2689c81484 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -1,14 +1,17 @@ Technical notes on version 2.1 General: +01Apr07 +kes Modify job report to include director name and Build OS. +kes Move drop and check_catalog() before fork. +kes Add update database scripts (version 9 to 10) to updatedb directory. 31Mar07 -ebl Check size and age of each file after their backup to see if - they have changed during backup. - It ask to fd to do an extra check (stat(2)) after +ebl Check size and age of each file after its backup to see if + it has changed during backup, if "checkfilechanges" is set. + The FD will do an extra check (stat(2)) after each file backup. mtime, ctime and size are compared with - "before backup" informations. If time or size mismatch, an - error will raise. - You must upgrade FD to use it. + 'before backup' information. If time or size mismatch, an + error message will be generated. You must upgrade FD to use it. 30Mar07 kes Make database name and user configurable --with-db-name=xxx --with-db-user=xxx diff --git a/bacula/updatedb/update_bdb_tables_9_to_10 b/bacula/updatedb/update_bdb_tables_9_to_10 new file mode 100755 index 0000000000..4a4e91a429 --- /dev/null +++ b/bacula/updatedb/update_bdb_tables_9_to_10 @@ -0,0 +1,9 @@ +#!/bin/sh +# +# Shell script to update bdb tables +# Nothing to do here. +# +echo " " +bindir=/home/kern/bacula/depkgs/sqlite + +exit 0 diff --git a/bacula/updatedb/update_mysql_tables_9_to_10 b/bacula/updatedb/update_mysql_tables_9_to_10 new file mode 100755 index 0000000000..c31b96980d --- /dev/null +++ b/bacula/updatedb/update_mysql_tables_9_to_10 @@ -0,0 +1,76 @@ +#!/bin/sh +# +# Shell script to update MySQL tables from version 1.38 to 2.0 +# +echo " " +echo "This script will update a Bacula MySQL database from version 9 to 10" +echo " which is needed to convert from Bacula version 1.38.x to 2.0.x or higher" +echo "Depending on the size of your database," +echo "this script may take several minutes to run." +echo " " +bindir=/home/kern/bacula/depkgs/sqlite + +if $bindir/mysql $* -f <