]> git.sur5r.net Git - bacula/bacula/commitdiff
Apply SunOS patch for ACLs submitted by David Duchscher.
authorKern Sibbald <kern@sibbald.com>
Mon, 14 Nov 2005 20:20:19 +0000 (20:20 +0000)
committerKern Sibbald <kern@sibbald.com>
Mon, 14 Nov 2005 20:20:19 +0000 (20:20 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2588 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/examples/bacula_mail_summary.sh [new file with mode: 0755]
bacula/kes-1.38
bacula/src/filed/acl.c
bacula/src/stored/askdir.c
bacula/src/stored/dev.c
bacula/src/stored/dircmd.c

diff --git a/bacula/examples/bacula_mail_summary.sh b/bacula/examples/bacula_mail_summary.sh
new file mode 100755 (executable)
index 0000000..266bfd1
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+# This script is to create a summary of the job notifications from bacula
+# and send it to people who care.
+#
+# For it to work, you need to have all Bacula job report
+# mails cc'd to a unix mailbox called 'bacula', but of course you can edit
+# as appropriate. This should be run after all backup jobs have finished.
+# Tested with bacula-1.38.0
+
+# Contributed by Andrew J. Millar <andrew@alphajuliet.org.uk>
+
+# Use awk to create the report, pass to column to be
+# formatted nicely, then on to mail to be sent to
+# people who care.
+EMAIL_LIST="peoplewhocare@company.com"
+awk -F\:\  'BEGIN {
+                        print "Client Status Type StartTime EndTime Files Bytes"
+                }
+        /Client/ {
+                CLIENT=$2; sub(/"/, "", CLIENT) ; sub(/".*$/, "", CLIENT)
+        }
+        /Backup Level/ {
+                TYPE=$2 ; sub(/,.*$/, "", TYPE)
+        }
+        /Start time/ {
+                STARTTIME=$2; sub(/.*-.*-.* /, "", STARTTIME)
+        }
+        /End time/ {
+                ENDTIME=$2; sub(/.*-.*-.* /, "", ENDTIME)
+        }
+        /SD Files Written/ {
+                SDFILES=$2
+        }
+         /SD Bytes Written/ {
+                SDBYTES=$2
+        }
+        /Termination/ {
+                TERMINATION=$2 ;
+                sub(/Backup/, "", TERMINATION) ;
+                printf "%s %s %s %s %s %s %s \n", CLIENT,TERMINATION,TYPE,STARTTIME,ENDTIME,SDFILES,SDBYTES}' /var/spool/mail/bacula | \
+        column -t | \
+        mail -s "Bacula Summary for `date -d yesterday +%a,\ %D`" ${EMAIL_LIST}
+#
+# Empty the mailbox
+cat /dev/null > /var/spool/mail/bacula
+#
+# That's all folks
index 2b34409539587bef86dedab8d2328c518c5a34d8..e5b0f313e2873cf28b4b9df05ccb5fa63829c7da 100644 (file)
@@ -4,7 +4,16 @@
 General:
 
 Changes to 1.38.1:
+14Oct05
+- Apply SunOS patch for ACLs submitted by David Duchscher.                  
+- Make sure to set storage before trying to set drive.
+- Add bacula_mail_summary.sh to examples directory. It makes
+  a single email summary of any number of jobs. Submitted
+  by Adrew J. Millar.
+- Make sure when we do a mount to unblock the device even
+  if the drive could not be opened.  
 13Oct05
+- Merge Scott's new spec files.
 - Add doc on setting up Win32 environment variable supplied
   by Kees van den Broek.               
 - Turn off API debug output unless debug set to avoid confusing
index 46a98ce252ed8629c01b602f7ff20d9b970109f5..b8f98bcb455942d5dc56d8bb8bee0156d68cb166 100644 (file)
 
 #include "bacula.h"
 #include "filed.h"
-/* So we can free system allocated memory */
-#undef free
-#undef malloc
-#define malloc &* dont use malloc in this routine
 
 #else
 /*
@@ -117,6 +113,9 @@ JCR jcr;
    || !( defined(HAVE_LINUX_OS) \
       || defined(HAVE_FREEBSD_OS) \
       || defined(HAVE_DARWIN_OS) \
+      || defined(HAVE_IRIX_OS) \
+      || defined(HAVE_OSF1_OS) \
+      || defined(HAVE_SUN_OS) \
        )
 
 /* bacl_get() returns the lenght of the string, or -1 on error. */
@@ -318,7 +317,7 @@ int bacl_get(JCR *jcr, int acltype)
    if (acl(jcr->last_fname, GETACL, n, acls) == n) {
       if ((acl_text = acltotext(acls, n)) != NULL) {
          len = pm_strcpy(jcr->acl_text, acl_text);
-         free(acl_text);
+         actuallyfree(acl_text);
          free(acls);
          return len;
       }
@@ -336,11 +335,11 @@ int bacl_set(JCR *jcr, int acltype)
    if (!acls) {
       return -1;
    }
-   if (acl(jcr->last_fname, SETACL, n, acls) != 0) {
-      free(acls);
+   if (acl(jcr->last_fname, SETACL, n, acls) == -1) {
+      actuallyfree(acls);
       return -1;
    }
-   free(acls);
+   actuallyfree(acls);
    return 0;
 }
 
index 08176ce3a9d992acc26b4b2ce011e88389e41b6e..b9f4340b6c500c3d73482b19a4007c4d4ac019f3 100644 (file)
@@ -477,7 +477,7 @@ bool dir_ask_sysop_to_create_appendable_volume(DCR *dcr)
 
       stat = wait_for_sysop(dcr);
       if (dev->poll) {
-         Dmsg1(400, "Poll timeout in create append vol on device %s\n", dev->print_name());
+         Dmsg1(000, "Poll timeout in create append vol on device %s\n", dev->print_name());
          continue;
       }
 
@@ -486,7 +486,7 @@ bool dir_ask_sysop_to_create_appendable_volume(DCR *dcr)
             Mmsg(dev->errmsg, _("Max time exceeded waiting to mount Storage Device %s for Job %s\n"),
                dev->print_name(), jcr->Job);
             Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
-            Dmsg1(400, "Gave up waiting on device %s\n", dev->print_name());
+            Dmsg1(000, "Gave up waiting on device %s\n", dev->print_name());
             return false;             /* exceeded maximum waits */
          }
          continue;
@@ -503,7 +503,7 @@ bool dir_ask_sysop_to_create_appendable_volume(DCR *dcr)
          Jmsg(jcr, M_WARNING, 0, _("pthread error in mount_next_volume stat=%d ERR=%s\n"), stat,
             be.strerror(stat));
       }
-      Dmsg1(400, "Someone woke me for device %s\n", dev->print_name());
+      Dmsg1(000, "Someone woke me for device %s\n", dev->print_name());
 
       /* If no VolumeName, and cannot get one, try again */
       P(dev->mutex);
@@ -531,7 +531,7 @@ bool dir_ask_sysop_to_create_appendable_volume(DCR *dcr)
    }
    set_jcr_job_status(jcr, JS_Running);
    dir_send_job_status(jcr);
-   Dmsg0(400, "leave dir_ask_sysop_to_mount_create_appendable_volume\n");
+   Dmsg0(000, "leave dir_ask_sysop_to_mount_create_appendable_volume\n");
    return true;
 }
 
index b01c6703832aa9026432f799a4c7e6b40f39ad93..7dc108cab7eb336bd7a42e8a4716c489d8b34879 100644 (file)
@@ -359,24 +359,25 @@ void DEVICE::open_tape_device(DCR *dcr, int omode)
    /* Use system open() */
    while ((fd = ::open(dev_name, mode+nonblocking, MODE_RW)) < 0) {
       berrno be;
-      Dmsg2(100, "Open error errno=%d ERR=%s\n", errno, be.strerror());
-      if (errno == EINTR || errno == EAGAIN) {
+      dev_errno = errno;
+      Dmsg5(050, "Open omode=%d mode=%x nonblock=%d error errno=%d ERR=%s\n", 
+           omode, mode, nonblocking, errno, be.strerror());
+      if (dev_errno == EINTR || dev_errno == EAGAIN) {
          Dmsg0(100, "Continue open\n");
          continue;
       }
       /* Busy wait for specified time (default = 5 mins) */
-      if (errno == EBUSY && timeout-- > 0) {
+      if (dev_errno == EBUSY && timeout-- > 0) {
          Dmsg2(100, "Device %s busy. ERR=%s\n", print_name(), be.strerror());
          bmicrosleep(1, 0);
          continue;
       }
       /* IO error (no volume) try 10 times every 6 seconds */
-      if (errno == EIO && ioerrcnt-- > 0) {
+      if (dev_errno == EIO && ioerrcnt-- > 0) {
          bmicrosleep(5, 0);
          Dmsg0(100, "Continue open\n");
          continue;
       }
-      dev_errno = errno;
       Mmsg2(errmsg, _("Unable to open device %s: ERR=%s\n"),
             print_name(), be.strerror(dev_errno));
       /* Stop any open timer we set */
index f3fa17f209227b10cf27721fdaf6fd1c1709f46f..5a06eeba48f43546d22a274b8724105e898afbcc 100644 (file)
@@ -581,6 +581,11 @@ static bool mount_cmd(JCR *jcr)
                bnet_fsend(dir, _("3901 open device failed: ERR=%s\n"),
                   strerror_dev(dev));
                dev->open_nowait = false;
+               if (dev->dev_blocked == BST_UNMOUNTED) {
+                  /* We blocked the device, so unblock it */
+                  Dmsg0(100, "Unmounted. Unblocking device\n");
+                  unblock_device(dev);
+               }
                break;
             }
             dev->open_nowait = false;