From 348a6edf016087430b70b747a0bbfbfbbcc02ae7 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 16 Apr 2004 19:07:48 +0000 Subject: [PATCH] Add stats to bscan git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1217 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/ChangeLog | 9 +++++++++ bacula/ReleaseNotes | 9 +++++++++ bacula/src/dird/backup.c | 6 +++++- bacula/src/lib/jcr.c | 2 +- bacula/src/stored/bscan.c | 11 +++++++++++ bacula/src/tools/bsmtp.c | 20 ++++++++++++++++++-- bacula/src/version.h | 4 ++-- 7 files changed, 55 insertions(+), 6 deletions(-) diff --git a/bacula/ChangeLog b/bacula/ChangeLog index b6b338a6ab..54906ff122 100644 --- a/bacula/ChangeLog +++ b/bacula/ChangeLog @@ -1,4 +1,13 @@ +16Apr04 +- Modify bscan to print some elementary statistics (#Jobs, #Files, ...) + added to catalog. +15Apr04 +- Added --enable-wx-console and updated Makefile.in +- Fix mtx-changer so that the calling sequence is compatible + with the previous version (the new one required arguments that + were not necessarily used). +- Document how to use stunnel with Bacula. 13Apr04 - Fix crash in query command. - Remove schedule from the default restore job. diff --git a/bacula/ReleaseNotes b/bacula/ReleaseNotes index 807e8fd718..c7191140cc 100644 --- a/bacula/ReleaseNotes +++ b/bacula/ReleaseNotes @@ -7,6 +7,15 @@ Changes for 1.34.1: - Autochanger users, please note you must add %d to the end of the changer command line in your Device resource in your bacula-sd.conf file. +- Modify bscan to print some elementary statistics (#Jobs, #Files, ...) + added to catalog. +- Added --enable-wx-console and updated Makefile.in +- Fix mtx-changer so that the calling sequence is compatible + with the previous version (the new one required arguments that + were not necessarily used). +- Document how to use stunnel with Bacula. +- Fix crash in query command. +- Remove schedule from the default restore job. - Fix data spooler to use min/max tape blocking factors. - Automatically turn of conio if library not found instead of bombing. - Cleaned up a lot of copyright dates. diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index a2773826e2..16f75993a0 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -395,7 +395,11 @@ static void backup_cleanup(JCR *jcr, int TermCode, char *since, FILESET_DBR *fsr msg_type = M_INFO; /* by default INFO message */ switch (jcr->JobStatus) { case JS_Terminated: - term_msg = _("Backup OK"); + if (jcr->Errors || jcr->SDErrors) { + term_msg = _("Backup OK with warnings"); + } else { + term_msg = _("Backup OK"); + } break; case JS_FatalError: case JS_ErrorTerminated: diff --git a/bacula/src/lib/jcr.c b/bacula/src/lib/jcr.c index 86113f3375..2b10d6b936 100755 --- a/bacula/src/lib/jcr.c +++ b/bacula/src/lib/jcr.c @@ -201,7 +201,7 @@ JCR *new_jcr(int size, JCR_free_HANDLER *daemon_free_jcr) /* Setup some dummy values */ jcr->Job[0] = 0; /* no job name by default */ jcr->JobId = 0; - jcr->JobType = JT_ADMIN; + jcr->JobType = JT_SYSTEM; /* internal job until defined */ jcr->JobLevel = L_NONE; jcr->JobStatus = JS_Created; diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index 0988a292e7..059cf0f854 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -90,6 +90,11 @@ static int update_vol_info = 0; static int list_records = 0; static int ignored_msgs = 0; +static int num_jobs = 0; +static int num_pools = 0; +static int num_media = 0; +static int num_files = 0; + #define CONFIG_FILE "bacula-sd.conf" char *configfile; bool forge_on = false; @@ -256,6 +261,8 @@ int main (int argc, char *argv[]) } do_scan(); + printf("Records added to catalog:\n%7d Media\n%7d Pool\n%7d Job\n%7d File\n", + num_media, num_pools, num_jobs, num_files); free_jcr(bjcr); return 0; @@ -352,6 +359,7 @@ static int record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec) /* Check Pool info */ bstrncpy(pr.Name, dev->VolHdr.PoolName, sizeof(pr.Name)); bstrncpy(pr.PoolType, dev->VolHdr.PoolType, sizeof(pr.PoolType)); + num_pools++; if (db_get_pool_record(bjcr, db, &pr)) { if (verbose) { Pmsg1(000, _("Pool record for %s found in DB.\n"), pr.Name); @@ -375,6 +383,7 @@ static int record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec) memset(&mr, 0, sizeof(mr)); bstrncpy(mr.VolumeName, dev->VolHdr.VolName, sizeof(mr.VolumeName)); mr.PoolId = pr.PoolId; + num_media++; if (db_get_media_record(bjcr, db, &mr)) { if (verbose) { Pmsg1(000, _("Media record for %s found in DB.\n"), mr.VolumeName); @@ -410,6 +419,7 @@ static int record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec) case SOS_LABEL: mr.VolJobs++; + num_jobs++; if (ignored_msgs > 0) { Pmsg1(000, _("%d \"errors\" ignored before first Start of Session record.\n"), ignored_msgs); @@ -589,6 +599,7 @@ static int record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec) } fr.JobId = mjcr->JobId; fr.FileId = 0; + num_files++; if (db_get_file_attributes_record(bjcr, db, attr->fname, NULL, &fr)) { if (verbose > 1) { Pmsg1(000, _("File record already exists for: %s\n"), attr->fname); diff --git a/bacula/src/tools/bsmtp.c b/bacula/src/tools/bsmtp.c index 4df5776f8e..1b4fbdc970 100644 --- a/bacula/src/tools/bsmtp.c +++ b/bacula/src/tools/bsmtp.c @@ -33,8 +33,24 @@ */ +#ifdef APCUPSD + +#include "apc.h" +#undef main +#define my_name_is(x) +#define bstrdup(x) strdup(x) +UPSINFO myUPS; +UPSINFO *core_ups = &myUPS; +#define MY_NAME "smtp" + +#else + #include "bacula.h" #include "jcr.h" +#define MY_NAME "bsmtp" + +#endif + #ifndef MAXSTRING #define MAXSTRING 254 @@ -102,14 +118,14 @@ static void usage() { fprintf(stderr, "\n" -"Usage: bsmtp [-f from] [-h mailhost] [-s subject] [-c copy] [recepient ...]\n" +"Usage: %s [-f from] [-h mailhost] [-s subject] [-c copy] [recepient ...]\n" " -c set the Cc: field\n" " -dnn set debug level to nn\n" " -f set the From: field\n" " -h use mailhost:port as the SMTP server\n" " -s set the Subject: field\n" " -? print this message.\n" -"\n"); +"\n", MY_NAME); exit(1); } diff --git a/bacula/src/version.h b/bacula/src/version.h index 60c5623f98..b5e80cb33c 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -2,8 +2,8 @@ #undef VERSION #define VERSION "1.35.0" #define VSTRING "1" -#define BDATE "15 Apr 2004" -#define LSMDATE "15Apr04" +#define BDATE "16 Apr 2004" +#define LSMDATE "16Apr04" /* Debug flags */ #undef DEBUG -- 2.39.5