From 4e502c79e55a6e7de8f9109e96322481d189acd9 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 25 Oct 2008 09:39:08 +0000 Subject: [PATCH] kes Ensure that job report is always printed even if job is failed in the director. kes Don't print job report twice for failed VBackup jobs. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7900 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/dird/backup.c | 1 + bacula/src/dird/job.c | 113 +++++++++++++++++++-------------------- bacula/src/version.h | 4 +- bacula/technotes-2.5 | 4 ++ 4 files changed, 61 insertions(+), 61 deletions(-) diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index a09bc35a45..18286b5f7d 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -444,6 +444,7 @@ void backup_cleanup(JCR *jcr, int TermCode) if (jcr->get_JobLevel() == L_VIRTUAL_FULL) { vbackup_cleanup(jcr, TermCode); + return; } Dmsg2(100, "Enter backup_cleanup %d %c\n", TermCode, TermCode); diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index adaf765a10..dba894a8af 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -284,68 +284,63 @@ static void *job_thread(void *arg) /* Run any script BeforeJob on dird */ run_scripts(jcr, jcr->job->RunScripts, "BeforeJob"); - if (job_canceled(jcr)) { - update_job_end(jcr, jcr->JobStatus); + /* + * We re-update the job start record so that the start + * time is set after the run before job. This avoids + * that any files created by the run before job will + * be saved twice. They will be backed up in the current + * job, but not in the next one unless they are changed. + * Without this, they will be backed up in this job and + * in the next job run because in that case, their date + * is after the start of this run. + */ + jcr->start_time = time(NULL); + jcr->jr.StartTime = jcr->start_time; + if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) { + Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); + } + generate_job_event(jcr, "JobRun"); - } else { - /* - * We re-update the job start record so that the start - * time is set after the run before job. This avoids - * that any files created by the run before job will - * be saved twice. They will be backed up in the current - * job, but not in the next one unless they are changed. - * Without this, they will be backed up in this job and - * in the next job run because in that case, their date - * is after the start of this run. - */ - jcr->start_time = time(NULL); - jcr->jr.StartTime = jcr->start_time; - if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) { - Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); + switch (jcr->get_JobType()) { + case JT_BACKUP: + if (!job_canceled(jcr) && do_backup(jcr)) { + do_autoprune(jcr); + } else { + backup_cleanup(jcr, JS_ErrorTerminated); } - generate_job_event(jcr, "JobRun"); - - switch (jcr->get_JobType()) { - case JT_BACKUP: - if (do_backup(jcr)) { - do_autoprune(jcr); - } else { - backup_cleanup(jcr, JS_ErrorTerminated); - } - break; - case JT_VERIFY: - if (do_verify(jcr)) { - do_autoprune(jcr); - } else { - verify_cleanup(jcr, JS_ErrorTerminated); - } - break; - case JT_RESTORE: - if (do_restore(jcr)) { - do_autoprune(jcr); - } else { - restore_cleanup(jcr, JS_ErrorTerminated); - } - break; - case JT_ADMIN: - if (do_admin(jcr)) { - do_autoprune(jcr); - } else { - admin_cleanup(jcr, JS_ErrorTerminated); - } - break; - case JT_COPY: - case JT_MIGRATE: - if (do_migration(jcr)) { - do_autoprune(jcr); - } else { - migration_cleanup(jcr, JS_ErrorTerminated); - } - break; - default: - Pmsg1(0, _("Unimplemented job type: %d\n"), jcr->get_JobType()); - break; + break; + case JT_VERIFY: + if (!job_canceled(jcr) && do_verify(jcr)) { + do_autoprune(jcr); + } else { + verify_cleanup(jcr, JS_ErrorTerminated); + } + break; + case JT_RESTORE: + if (!job_canceled(jcr) && do_restore(jcr)) { + do_autoprune(jcr); + } else { + restore_cleanup(jcr, JS_ErrorTerminated); } + break; + case JT_ADMIN: + if (!job_canceled(jcr) && do_admin(jcr)) { + do_autoprune(jcr); + } else { + admin_cleanup(jcr, JS_ErrorTerminated); + } + break; + case JT_COPY: + case JT_MIGRATE: + if (!job_canceled(jcr) && do_migration(jcr)) { + do_autoprune(jcr); + } else { + migration_cleanup(jcr, JS_ErrorTerminated); + } + break; + default: + Pmsg1(0, _("Unimplemented job type: %d\n"), jcr->get_JobType()); + break; } run_scripts(jcr, jcr->job->RunScripts, "AfterJob"); diff --git a/bacula/src/version.h b/bacula/src/version.h index 6bd9d09bf4..c26d6cf5b0 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.5.17" -#define BDATE "24 October 2008" -#define LSMDATE "24Oct08" +#define BDATE "25 October 2008" +#define LSMDATE "25Oct08" #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n" #define BYEAR "2008" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index bb10defe89..05beb8112b 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -18,6 +18,10 @@ libtool remove reader/writer in FOPTS???? General: +25Oct08 +kes Ensure that job report is always printed even if job is failed + in the director. +kes Don't print job report twice for failed VBackup jobs. 24Oct08 kes Fix editing of retention time difference to use 64 bit int instead of 64 bit unsigned. This should permit very -- 2.39.2