From: Kern Sibbald Date: Mon, 8 Nov 2004 21:12:12 +0000 (+0000) Subject: 08Nov04 X-Git-Tag: Release-1.36.1~42 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f56cb64e95f6e3a4d547edc077aa03c3493532ce;p=bacula%2Fbacula 08Nov04 - More doc updates - Fix ps command for OpenBSD - Rework the creation of indexes for SQL -- fall back to the old code, but document what can be added. 06Nov04 - Add new Daemon message handler in default DIR conf. 05Nov04 - Fix Seg Fault with -D100 in bpipe.c. - Fix Seg Fault in run specifying a JobId. - Make mail from daemon with a Messages Resource use the MailCommand with editing rather than the default sendmail. - Replace Jmsg in dispatch_message() with Qmsg. - Make edit_job_codes handle NULL jcr. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1675 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index d7b4afc0da..7a275e5442 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -1646,7 +1646,7 @@ openbsd) lld="qd" llu="qu" TAPEDRIVE="/dev/nrst0" - PSCMD="ps -a -o pid,command" + PSCMD="ps -ax -o pid,command" PTHREAD_LIB="-pthread" CFLAGS="${CFLAGS} -pthread" PFILES="${PFILES} \ @@ -1699,7 +1699,7 @@ gentoo) PSCMD="ps -e -o pid,command" PFILES="${PFILES} \ platforms/gentoo/Makefile \ - platforms/gentoo/bacula-init \ + platforms/gentoo/bacula-init \ platforms/gentoo/bacula-fd \ platforms/gentoo/bacula-sd \ platforms/gentoo/bacula-dir" @@ -1819,7 +1819,7 @@ AC_OUTPUT([autoconf/Make.common \ scripts/bacula.desktop.gnome2.xsu \ scripts/gnome-console.console_apps \ scripts/mtx-changer \ - scripts/bacula-tray-monitor.desktop \ + scripts/bacula-tray-monitor.desktop \ doc/Makefile \ src/Makefile \ src/host.h \ diff --git a/bacula/configure b/bacula/configure index 29de6b0a08..91c67c525d 100755 --- a/bacula/configure +++ b/bacula/configure @@ -19038,7 +19038,7 @@ openbsd) lld="qd" llu="qu" TAPEDRIVE="/dev/nrst0" - PSCMD="ps -a -o pid,command" + PSCMD="ps -ax -o pid,command" PTHREAD_LIB="-pthread" CFLAGS="${CFLAGS} -pthread" PFILES="${PFILES} \ @@ -19091,7 +19091,7 @@ gentoo) PSCMD="ps -e -o pid,command" PFILES="${PFILES} \ platforms/gentoo/Makefile \ - platforms/gentoo/bacula-init \ + platforms/gentoo/bacula-init \ platforms/gentoo/bacula-fd \ platforms/gentoo/bacula-sd \ platforms/gentoo/bacula-dir" diff --git a/bacula/kernstodo b/bacula/kernstodo index 49a3d72ad8..63abca7d47 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -7,13 +7,15 @@ Project Developer IPv6_2 Meno Abels Data encryption Meno Abels (see projects) Communication encryption Meno Abels -Version 1.35 Kern (see below) +Version 1.37 Kern (see below) ======================================================== -1.37 Items to do for release: - - 1.37 Items: +- Make bls list files but with VolID, VolTime, FileIndex +- Modify Backing up Your Database to include a bootstrap file. +- Add restore of specific JobId to regression. +- Add date/time to each Jmsg. +- Think about making certain database errors fatal. - Look at correcting the time jump in the sceduler for daylight savings time changes. - Add a "real" timer to network connections. diff --git a/bacula/scripts/.cvsignore b/bacula/scripts/.cvsignore index fb2c8deb41..b0dbddcbfc 100644 --- a/bacula/scripts/.cvsignore +++ b/bacula/scripts/.cvsignore @@ -1,3 +1,4 @@ +bacula-tray-monior.desktop .xvpics logrotate bacula.desktop diff --git a/bacula/src/cats/make_mysql_tables.in b/bacula/src/cats/make_mysql_tables.in index 4f668d9430..3f292ea447 100644 --- a/bacula/src/cats/make_mysql_tables.in +++ b/bacula/src/cats/make_mysql_tables.in @@ -32,12 +32,19 @@ CREATE TABLE File ( LStat TINYBLOB NOT NULL, MD5 TINYBLOB NOT NULL, PRIMARY KEY(FileId), - INDEX (JobId), - INDEX (PathId), - INDEX (FilenameId), - INDEX (JobId, PathId, FilenameId) + INDEX (FilenameId, PathId) ); +# +# Possibly add one or more of the following indexes +# to the above File table if your Verifies are +# too slow. +# +# INDEX (JobId), +# INDEX (PathId), +# INDEX (FilenameId), +# INDEX (JobId, PathId, FilenameId) +# CREATE TABLE Job ( JobId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, diff --git a/bacula/src/cats/make_postgresql_tables.in b/bacula/src/cats/make_postgresql_tables.in index 513556adc6..b067f1548b 100644 --- a/bacula/src/cats/make_postgresql_tables.in +++ b/bacula/src/cats/make_postgresql_tables.in @@ -211,9 +211,15 @@ create table file ); create index file_jobid_idx on file (jobid); -create index file_pathid_idx on file(pathid); -create index file_filenameid_idx on file(filenameid); -create index file_jpfid_idx on file (jobid, pathid, filenameid); +create index file_fp_idx on file (filenameid, pathid); + +-- +-- Possibly add one or more of the following indexes +-- if your Verifies are too slow. +-- +-- create index file_pathid_idx on file(pathid); +-- create index file_filenameid_idx on file(filenameid); +-- create index file_jpfid_idx on file (jobid, pathid, filenameid); create table jobmedia ( diff --git a/bacula/src/cats/make_sqlite_tables.in b/bacula/src/cats/make_sqlite_tables.in index 7102e196ae..a780f9dc50 100644 --- a/bacula/src/cats/make_sqlite_tables.in +++ b/bacula/src/cats/make_sqlite_tables.in @@ -36,9 +36,14 @@ CREATE TABLE File ( ); CREATE INDEX inx3 ON File (JobId); -CREATE INDEX inx4 ON File (PathId); -CREATE INDEX inx5 ON File (FileNameId); -CREATE INDEX inx9 ON File (JobId, PathId, FileNameId); +CREATE INDEX inx4 ON File (FilenameId, PathId); +-- +-- Possibly add one or more of the following indexes +-- if your Verifies are too slow. +-- +-- CREATE INDEX inx4 ON File (PathId); +-- CREATE INDEX inx5 ON File (FileNameId); +-- CREATE INDEX inx9 ON File (JobId, PathId, FilenameId); CREATE TABLE Job ( JobId INTEGER UNSIGNED NOT NULL, diff --git a/bacula/src/dird/bacula-dir.conf.in b/bacula/src/dird/bacula-dir.conf.in index 3947a33134..83c8ff6711 100644 --- a/bacula/src/dird/bacula-dir.conf.in +++ b/bacula/src/dird/bacula-dir.conf.in @@ -20,7 +20,7 @@ Director { # define myself PidDirectory = "@piddir@" Maximum Concurrent Jobs = 1 Password = "@dir_password@" # Console password - Messages = Standard + Messages = Daemon } JobDefs { @@ -212,6 +212,20 @@ Messages { # append = "@working_dir@/log" = all, !skipped } + + +# +# Message delivery for daemon messages (no job). +Messages { + Name = Daemon + mailcommand = "@sbindir@/bsmtp -h @smtp_host@ -f \"\(Bacula\) %r\" -s \"Bacula daemon message\" %r" + mail = @job_email@ = all, !skipped + console = all, !skipped, !saved + append = "@working_dir@/log" = all, !skipped +} + + + # Default pool definition Pool { diff --git a/bacula/src/dird/ua_run.c b/bacula/src/dird/ua_run.c index 4cdb03f00a..52aeff5a55 100644 --- a/bacula/src/dird/ua_run.c +++ b/bacula/src/dird/ua_run.c @@ -580,7 +580,6 @@ Priority: %d\n"), "Bootstrap: %s\n" "Where: %s\n" "Replace: %s\n" - "FileSet: %s\n" "Client: %s\n" "Storage: %s\n" "JobId: %s\n" diff --git a/bacula/src/lib/bpipe.c b/bacula/src/lib/bpipe.c index c432f1c6d5..93238b26e2 100644 --- a/bacula/src/lib/bpipe.c +++ b/bacula/src/lib/bpipe.c @@ -220,7 +220,7 @@ int close_bpipe(BPIPE *bpipe) if (WIFEXITED(chldstatus)) { /* process exit()ed */ stat = WEXITSTATUS(chldstatus); if (stat != 0) { - Dmsg1(100, "Non-zero status %s returned from child.\n", stat); + Dmsg1(200, "Non-zero status %d returned from child.\n", stat); stat |= b_errno_exit; /* exit status returned */ } Dmsg1(200, "child status=%d\n", stat & ~b_errno_exit); diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index 0165e9f0cc..905568b7a2 100755 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -374,16 +374,11 @@ static void make_unique_mail_filename(JCR *jcr, POOLMEM *&name, DEST *d) static BPIPE *open_mail_pipe(JCR *jcr, POOLMEM *&cmd, DEST *d) { BPIPE *bpipe; - int use_bsmtp = (d->mail_cmd && jcr); - if (use_bsmtp) { + if (d->mail_cmd) { cmd = edit_job_codes(jcr, cmd, d->mail_cmd, d->where); } else { -#if 1 Mmsg(cmd, "/usr/lib/sendmail -F Bacula %s", d->where); -#else - Mmsg(cmd, "mail -s \"Bacula Message\" %s", d->where); -#endif } fflush(stdout); @@ -393,11 +388,10 @@ static BPIPE *open_mail_pipe(JCR *jcr, POOLMEM *&cmd, DEST *d) cmd, be.strerror()); } -#if 1 - if (!use_bsmtp) { + /* If we had to use sendmail, add subject */ + if (!d->mail_cmd) { fprintf(bpipe->wfd, "Subject: Bacula Message\r\n\r\n"); } -#endif return bpipe; } @@ -655,7 +649,7 @@ void dispatch_message(JCR *jcr, int type, int level, char *msg) if (stat != 0) { berrno be; be.set_errno(stat); - Jmsg2(jcr, M_ERROR, 0, _("Operator mail program terminated in error.\n" + Qmsg2(jcr, M_ERROR, 0, _("Operator mail program terminated in error.\n" "CMD=%s\n" "ERR=%s\n"), mcmd, be.strerror()); } @@ -671,7 +665,7 @@ void dispatch_message(JCR *jcr, int type, int level, char *msg) d->fd = fopen(name, "w+"); if (!d->fd) { d->fd = stdout; - Jmsg2(jcr, M_ERROR, 0, "fopen %s failed: ERR=%s\n", name, strerror(errno)); + Qmsg2(jcr, M_ERROR, 0, "fopen %s failed: ERR=%s\n", name, strerror(errno)); d->fd = NULL; free_pool_memory(name); break; @@ -690,7 +684,7 @@ void dispatch_message(JCR *jcr, int type, int level, char *msg) d->fd = fopen(d->where, "w+"); if (!d->fd) { d->fd = stdout; - Jmsg2(jcr, M_ERROR, 0, "fopen %s failed: ERR=%s\n", d->where, strerror(errno)); + Qmsg2(jcr, M_ERROR, 0, "fopen %s failed: ERR=%s\n", d->where, strerror(errno)); d->fd = NULL; break; } @@ -703,7 +697,7 @@ void dispatch_message(JCR *jcr, int type, int level, char *msg) d->fd = fopen(d->where, "a"); if (!d->fd) { d->fd = stdout; - Jmsg2(jcr, M_ERROR, 0, "fopen %s failed: ERR=%s\n", d->where, strerror(errno)); + Qmsg2(jcr, M_ERROR, 0, "fopen %s failed: ERR=%s\n", d->where, strerror(errno)); d->fd = NULL; break; } diff --git a/bacula/src/lib/util.c b/bacula/src/lib/util.c index 52dbe698ae..32f9d0afab 100644 --- a/bacula/src/lib/util.c +++ b/bacula/src/lib/util.c @@ -542,7 +542,11 @@ POOLMEM *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to) str = "%"; break; case 'c': - str = jcr->client_name; + if (jcr) { + str = jcr->client_name; + } else { + str = "*none*"; + } if (!str) { str = ""; } @@ -551,39 +555,67 @@ POOLMEM *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to) str = my_name; /* Director's name */ break; case 'e': - str = job_status_to_str(jcr->JobStatus); + if (jcr) { + str = job_status_to_str(jcr->JobStatus); + } else { + str = "*none*"; + } break; case 'i': - bsnprintf(add, sizeof(add), "%d", jcr->JobId); - str = add; + if (jcr) { + bsnprintf(add, sizeof(add), "%d", jcr->JobId); + str = add; + } else { + str = "*none*"; + } break; case 'j': /* Job name */ - str = jcr->Job; + if (jcr) { + str = jcr->Job; + } else { + str = "*none*"; + } break; case 'l': - str = job_level_to_str(jcr->JobLevel); + if (jcr) { + str = job_level_to_str(jcr->JobLevel); + } else { + str = "*none*"; + } break; case 'n': - bstrncpy(name, jcr->Job, sizeof(name)); - /* There are three periods after the Job name */ - for (i=0; i<3; i++) { - if ((q=strrchr(name, '.')) != NULL) { - *q = 0; + if (jcr) { + bstrncpy(name, jcr->Job, sizeof(name)); + /* There are three periods after the Job name */ + for (i=0; i<3; i++) { + if ((q=strrchr(name, '.')) != NULL) { + *q = 0; + } } + str = name; + } else { + str = "*none*"; } - str = name; break; case 'r': str = to; break; case 't': - str = job_type_to_str(jcr->JobType); + if (jcr) { + str = job_type_to_str(jcr->JobType); + } else { + str = "*none*"; + } break; case 'v': - if (jcr->VolumeName && jcr->VolumeName[0]) { - str = jcr->VolumeName; + if (jcr) { + if (jcr->VolumeName && jcr->VolumeName[0]) { + str = jcr->VolumeName; + } else { + str = ""; + } } else { - str = ""; + str = "*none*"; } break; default: