]> git.sur5r.net Git - bacula/bacula/commitdiff
Include RunBefore/After output in job report
authorKern Sibbald <kern@sibbald.com>
Wed, 7 May 2003 09:18:00 +0000 (09:18 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 7 May 2003 09:18:00 +0000 (09:18 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@495 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/dird/Makefile.in
bacula/src/dird/backup.c
bacula/src/dird/job.c
bacula/src/filed/restore.c
bacula/src/findlib/attribs.c
bacula/src/findlib/create_file.c
bacula/src/findlib/makepath.c
bacula/src/version.h

index 5ec19ed3e2d8eee238953ba03e578a900bade141..30208e19caf5c3386e4c731b6e200cc2bbad470d 100644 (file)
@@ -22,8 +22,8 @@ first_rule: all
 dummy:
 
 #
-SVRSRCS = dird.c authenticate.c autoprune.c \
-         backup.c \
+SVRSRCS = dird.c admin.c authenticate.c \
+         autoprune.c backup.c \
          catreq.c dird_conf.c \
          fd_cmds.c getmsg.c inc_conf.c job.c \
          mountreq.c msgchan.c newvol.c \
@@ -35,8 +35,8 @@ SVRSRCS = dird.c authenticate.c autoprune.c \
          ua_purge.c ua_restore.c ua_run.c \
          ua_select.c ua_server.c \
          ua_status.c verify.c
-SVROBJS = dird.o authenticate.o autoprune.o \
-         backup.o \
+SVROBJS = dird.o admin.o authenticate.o \
+         autoprune.o backup.o \
          catreq.o dird_conf.o \
          fd_cmds.o getmsg.o inc_conf.o job.o \
          mountreq.o msgchan.o newvol.o \
index 358bb9650626352dc45b81ba01052d27a1081fd3..872b94c1061e815f4e78ebdd62b0cdd8b2e124a5 100644 (file)
@@ -4,9 +4,6 @@
  *
  *     Kern Sibbald, March MM
  *
- *    This routine is called as a thread. It may not yet be totally
- *     thread reentrant!!!
- *
  *  Basic tasks done here:
  *     Open DB and create records for this job.
  *     Open Message Channel with Storage daemon to tell him a job will be starting.
@@ -485,6 +482,5 @@ Termination:            %s\n\n"),
        sd_term_msg,
        term_msg);
 
-
    Dmsg0(100, "Leave backup_cleanup()\n");
 }
index 5da55395ea782b0de297bf9f88d470004417afd5..f9d258db5090605576f4f6aad23c92c114151901 100644 (file)
@@ -46,9 +46,9 @@ void run_job(JCR *jcr);
 extern void term_scheduler();
 extern void term_ua_server();
 extern int do_backup(JCR *jcr);
+extern int do_admin(JCR *jcr);
 extern int do_restore(JCR *jcr);
 extern int do_verify(JCR *jcr);
-extern void backup_cleanup(void);
 
 #ifdef USE_SEMAPHORE
 static semlock_t job_lock;
@@ -195,9 +195,15 @@ static void *job_thread(void *arg)
       if (jcr->job->RunBeforeJob) {
         POOLMEM *before = get_pool_memory(PM_FNAME);
         int status;
+        BPIPE *bpipe;
+        char line[MAXSTRING];
         
         before = edit_run_codes(jcr, before, jcr->job->RunBeforeJob);
-        status = run_program(before, 0, NULL);
+         bpipe = open_bpipe(before, 0, "r");
+        while (fgets(line, sizeof(line), bpipe->rfd)) {
+            Jmsg(jcr, M_INFO, 0, _("RunBefore: %s"), line);
+        }
+        status = close_bpipe(bpipe);
         if (status != 0) {
             Jmsg(jcr, M_FATAL, 0, _("RunBeforeJob returned non-zero status=%d\n"),
               status);
@@ -228,9 +234,10 @@ static void *job_thread(void *arg)
            }
            break;
         case JT_ADMIN:
-           /* No actual job */
-           do_autoprune(jcr);
-           set_jcr_job_status(jcr, JS_Terminated);
+           do_admin(jcr);
+           if (jcr->JobStatus == JS_Terminated) {
+              do_autoprune(jcr);
+           }
            break;
         default:
             Pmsg1(0, "Unimplemented job type: %d\n", jcr->JobType);
@@ -239,9 +246,15 @@ static void *job_thread(void *arg)
       if (jcr->job->RunAfterJob) {
         POOLMEM *after = get_pool_memory(PM_FNAME);
         int status;
-      
+        BPIPE *bpipe;
+        char line[MAXSTRING];
+        
         after = edit_run_codes(jcr, after, jcr->job->RunAfterJob);
-        status = run_program(after, 0, NULL);
+         bpipe = open_bpipe(after, 0, "r");
+        while (fgets(line, sizeof(line), bpipe->rfd)) {
+            Jmsg(jcr, M_INFO, 0, _("RunAfter: %s"), line);
+        }
+        status = close_bpipe(bpipe);
         if (status != 0) {
             Jmsg(jcr, M_FATAL, 0, _("RunAfterJob returned non-zero status=%d\n"),
               status);
index 1df512a849c0a931f0dee3ff7873d61d1c715898..e3ee6944807d84b8f7e421e49fd8d05eeb848aed 100644 (file)
@@ -369,7 +369,7 @@ void do_restore(JCR *jcr)
             Dmsg2(100, "Write uncompressed %d bytes, total before write=%d\n", compress_len, total);
            if ((uLong)bwrite(&bfd, jcr->compress_buf, compress_len) != compress_len) {
                Dmsg0(0, "===Write error===\n");
-               Jmsg2(jcr, M_ERROR, 0, "Write error on %s: %s\n", ofile, berror(&bfd));
+               Jmsg2(jcr, M_ERROR, 0, _("Write error on %s: %s\n"), ofile, berror(&bfd));
               goto bail_out;
            }
            total += compress_len;
@@ -378,7 +378,7 @@ void do_restore(JCR *jcr)
         }
 #else
         if (extract) {
-            Jmsg(jcr, M_ERROR, 0, "GZIP data stream found, but GZIP not configured!\n");
+            Jmsg(jcr, M_ERROR, 0, _("GZIP data stream found, but GZIP not configured!\n"));
            goto bail_out;
         }
 #endif
index 3a39b02dac7fe37fb5a4ba4a905aee571f22e09e..449841b5ceacfcc4d35d20beb2f893bc842edf52 100755 (executable)
@@ -217,18 +217,18 @@ int set_attributes(void *jcr, char *fname, char *ofile, char *lname,
    if (type == FT_LNK) {
       /* Change owner of link, not of real file */
       if (lchown(ofile, statp->st_uid, statp->st_gid) < 0) {
-         Jmsg2(jcr, M_WARNING, 0, "Unable to set file owner %s: ERR=%s\n",
+         Jmsg2(jcr, M_WARNING, 0, _("Unable to set file owner %s: ERR=%s\n"),
            ofile, strerror(errno));
         stat = 0;
       }
    } else {
       if (chown(ofile, statp->st_uid, statp->st_gid) < 0) {
-         Jmsg2(jcr, M_WARNING, 0, "Unable to set file owner %s: ERR=%s\n",
+         Jmsg2(jcr, M_WARNING, 0, _("Unable to set file owner %s: ERR=%s\n"),
            ofile, strerror(errno));
         stat = 0;
       }
       if (chmod(ofile, statp->st_mode) < 0) {
-         Jmsg2(jcr, M_WARNING, 0, "Unable to set file modes %s: ERR=%s\n",
+         Jmsg2(jcr, M_WARNING, 0, _("Unable to set file modes %s: ERR=%s\n"),
            ofile, strerror(errno));
         stat = 0;
       }
@@ -236,7 +236,7 @@ int set_attributes(void *jcr, char *fname, char *ofile, char *lname,
       /* FreeBSD user flags */
 #ifdef HAVE_CHFLAGS
       if (chflags(ofile, statp->st_flags) < 0) {
-         Jmsg2(jcr, M_WARNING, 0, "Unable to set file flags %s: ERR=%s\n",
+         Jmsg2(jcr, M_WARNING, 0, _("Unable to set file flags %s: ERR=%s\n"),
            ofile, strerror(errno));
         stat = 0;
       }
@@ -245,7 +245,7 @@ int set_attributes(void *jcr, char *fname, char *ofile, char *lname,
        * Reset file times.
        */
       if (utime(ofile, &ut) < 0) {
-         Jmsg2(jcr, M_ERROR, 0, "Unable to set file times %s: ERR=%s\n",
+         Jmsg2(jcr, M_ERROR, 0, _("Unable to set file times %s: ERR=%s\n"),
            ofile, strerror(errno));
         stat = 0;
       }
index 319cabac2d6d56f90cc8eea283a97ebf4d708341..42555260e28501229dab2d537745a6ff0681213f 100644 (file)
@@ -223,7 +223,7 @@ int create_file(void *jcr, char *fname, char *ofile, char *lname,
    case FT_DIR:
       Dmsg2(300, "Make dir mode=%o dir=%s\n", new_mode, ofile);
       if (make_path(jcr, ofile, new_mode, parent_mode, uid, gid, 0, NULL) != 0) {
-         Jmsg2(jcr, M_ERROR, 0, _("Could not make directory %s: ERR=%s.\n"), 
+         Jmsg2(jcr, M_ERROR, 0, _("Could not make directory %s: ERR=%s\n"), 
               ofile, berror(ofd));
         return CF_ERROR;
       }
@@ -239,7 +239,7 @@ int create_file(void *jcr, char *fname, char *ofile, char *lname,
    case FT_NORECURSE:
    case FT_NOFSCHG:
    case FT_NOOPEN:
-      Jmsg2(jcr, M_ERROR, 0, _("Original file %s not saved. Stat=%d\n"), fname, type);
+      Jmsg2(jcr, M_ERROR, 0, _("Original file %s not saved: type=%d\n"), fname, type);
    default:
       Jmsg2(jcr, M_ERROR, 0, _("Unknown file type %d; not restored: %s\n"), type, fname);
    }
@@ -249,7 +249,7 @@ int create_file(void *jcr, char *fname, char *ofile, char *lname,
 /*
  *  Returns: > 0 index into path where last path char is.
  *          0  no path
- *          -1 filename is zero
+ *          -1 filename is zero length
  */ 
 static int separate_path_and_file(void *jcr, char *fname, char *ofile)
 {
index 827b24072393ea2f24cf23b000b98ef5cd40d2fe..74324fc108a32682741d3a7e96fc61fcea38b82e 100644 (file)
@@ -112,11 +112,11 @@ make_dir(void *jcr, const char *dir, const char *dirpath, mode_t mode, int *crea
         would fail with EEXIST.  */
 
       if (stat(dir, &stats)) {
-          Jmsg(jcr, M_ERROR, 0, "Cannot create directory %s: %s\n"
+          Jmsg(jcr, M_ERROR, 0, _("Cannot create directory %s: ERR=%s\n")
                  dirpath, strerror(save_errno));
          fail = 1;
       } else if (!S_ISDIR(stats.st_mode)) {
-          Jmsg(jcr, M_ERROR, 0, "%s exists but is not a directory\n", quote(dirpath));
+          Jmsg(jcr, M_ERROR, 0, _("%s exists but is not a directory\n"), quote(dirpath));
          fail = 1;
       } else {
          /* DIR (aka DIRPATH) already exists and is a directory. */
@@ -253,7 +253,7 @@ make_path(
 #endif
                  ) {
                 /* Note, if we are restoring as NON-root, this may not be fatal */
-                 Jmsg(jcr, M_WARNING, 0, "Cannot change owner and/or group of %s: %s\n",
+                 Jmsg(jcr, M_WARNING, 0, _("Cannot change owner and/or group of %s: ERR=%s\n"),
                      quote(dirpath), strerror(errno));
              }
               Dmsg0(300, "Chown done.\n");
@@ -273,7 +273,7 @@ make_path(
             creating an entry in that directory.  This avoids making
             stat and mkdir process O(n^2) file name components.  */
          if (cwd.do_chdir && chdir(basename_dir) < 0) {
-              Jmsg(jcr, M_ERROR, 0, "Cannot chdir to directory, %s: %s\n",
+              Jmsg(jcr, M_ERROR, 0, _("Cannot chdir to directory, %s: ERR=%s\n"),
                     quote(dirpath), strerror(errno));
              umask(oldmask);
              cleanup(&cwd);
@@ -312,7 +312,7 @@ make_path(
 #endif
              )
            {
-              Jmsg(jcr, M_WARNING, 0, "Cannot change owner and/or group of %s: %s\n",
+              Jmsg(jcr, M_WARNING, 0, _("Cannot change owner and/or group of %s: ERR=%s\n"),
                     quote(dirpath), strerror(errno));
            }
       }
@@ -326,7 +326,7 @@ make_path(
          Dmsg1(300, "Final chmod mode=%o\n", mode);
       }
       if ((mode & ~S_IRWXUGO) && chmod(basename_dir, mode)) {
-          Jmsg(jcr, M_WARNING, 0, "Cannot change permissions of %s: %s\n"
+          Jmsg(jcr, M_WARNING, 0, _("Cannot change permissions of %s: ERR=%s\n")
             quote(dirpath), strerror(errno));
       }
 
@@ -341,7 +341,7 @@ make_path(
           *(p->dirname_end) = '\0';
           Dmsg2(300, "Reset parent mode=%o dir=%s\n", parent_mode, dirpath);
          if (chmod(dirpath, parent_mode)) {
-              Jmsg(jcr, M_WARNING, 0, "Cannot change permissions of %s: %s\n",
+              Jmsg(jcr, M_WARNING, 0, _("Cannot change permissions of %s: ERR=%s\n"),
                     quote (dirpath), strerror(errno));
          }
       }
@@ -351,7 +351,7 @@ make_path(
       const char *dirpath = argpath;
 
       if (!S_ISDIR(stats.st_mode)) {
-          Jmsg(jcr, M_ERROR, 0, "%s exists but is not a directory\n", quote(dirpath));
+          Jmsg(jcr, M_ERROR, 0, _("%s exists but is not a directory\n"), quote(dirpath));
          return 1;
       }
 
@@ -369,11 +369,11 @@ make_path(
              && errno != EPERM
 #endif
              ) {
-              Jmsg(jcr, M_WARNING, 0, "Cannot change owner and/or group of %s: %s\n",
+              Jmsg(jcr, M_WARNING, 0, _("Cannot change owner and/or group of %s: ERR=%s\n"),
                     quote(dirpath), strerror(errno));
            }
          if (chmod(dirpath, mode)) {
-              Jmsg(jcr, M_WARNING, 0, "Cannot change permissions of %s: %s\n",
+              Jmsg(jcr, M_WARNING, 0, _("Cannot change permissions of %s: ERR=%s\n"),
                                 quote(dirpath), strerror(errno));
          }
           Dmsg2(300, "pathexists chmod mode=%o dir=%s\n", mode, dirpath);
index b29dda41705e724de4c43c705b3d22f66d6af13d..caf7ec56fe0a3f2e48c76b8adf3bb11ea0775032 100644 (file)
@@ -1,8 +1,8 @@
 /* */
 #define VERSION "1.31"
 #define VSTRING "1"
-#define BDATE   "06 May 2003"
-#define LSMDATE "06May03"
+#define BDATE   "07 May 2003"
+#define LSMDATE "07May03"
 
 /* Debug flags */
 #define DEBUG 1