]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/backup.c
Fix hourly scheduling problem
[bacula/bacula] / bacula / src / dird / backup.c
index 2480afbcee82e2d5880feb7885ee3e3d111ca3a1..f6db260141c8577f23d6b6b9e831bd758137d4f2 100644 (file)
@@ -15,7 +15,7 @@
  */
 
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -120,10 +120,28 @@ int do_backup(JCR *jcr)
        jcr->JobId, jcr->Job);
 
    /* 
-    * Get the Pool record  
+    * Get the Pool record -- first apply any level defined pools  
     */
+   switch (jcr->JobLevel) {
+   case L_FULL:
+      if (jcr->full_pool) {
+        jcr->pool = jcr->full_pool;   
+      }
+      break;
+   case L_INCREMENTAL:
+      if (jcr->inc_pool) {
+        jcr->pool = jcr->inc_pool;   
+      }
+      break;
+   case L_DIFFERENTIAL:
+      if (jcr->dif_pool) {
+        jcr->pool = jcr->dif_pool;   
+      }
+      break;
+   }
    memset(&pr, 0, sizeof(pr));
    bstrncpy(pr.Name, jcr->pool->hdr.name, sizeof(pr.Name));
+
    while (!db_get_pool_record(jcr, jcr->db, &pr)) { /* get by Name */
       /* Try to create the pool */
       if (create_pool(jcr, jcr->db, jcr->pool, POOL_OP_CREATE) < 0) {
@@ -377,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:
@@ -385,14 +407,18 @@ static void backup_cleanup(JCR *jcr, int TermCode, char *since, FILESET_DBR *fsr
         msg_type = M_ERROR;          /* Generate error message */
         if (jcr->store_bsock) {
            bnet_sig(jcr->store_bsock, BNET_TERMINATE);
-           pthread_cancel(jcr->SD_msg_chan);
+           if (jcr->SD_msg_chan) {
+              pthread_cancel(jcr->SD_msg_chan);
+           }
         }
         break;
       case JS_Canceled:
          term_msg = _("Backup Canceled");
         if (jcr->store_bsock) {
            bnet_sig(jcr->store_bsock, BNET_TERMINATE);
-           pthread_cancel(jcr->SD_msg_chan);
+           if (jcr->SD_msg_chan) {
+              pthread_cancel(jcr->SD_msg_chan);
+           }
         }
         break;
       default:
@@ -434,6 +460,8 @@ static void backup_cleanup(JCR *jcr, int TermCode, char *since, FILESET_DBR *fsr
    jobstatus_to_ascii(jcr->FDJobStatus, fd_term_msg, sizeof(fd_term_msg));
    jobstatus_to_ascii(jcr->SDJobStatus, sd_term_msg, sizeof(sd_term_msg));
 
+// bmicrosleep(15, 0);               /* for debugging SIGHUP */
+
    Jmsg(jcr, msg_type, 0, _("Bacula " VERSION " (" LSMDATE "): %s\n\
 JobId:                  %d\n\
 Job:                    %s\n\