]> git.sur5r.net Git - bacula/bacula/commitdiff
Print error if Alert command fails + doc
authorKern Sibbald <kern@sibbald.com>
Sat, 14 Aug 2004 10:22:50 +0000 (10:22 +0000)
committerKern Sibbald <kern@sibbald.com>
Sat, 14 Aug 2004 10:22:50 +0000 (10:22 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1527 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/stored/acquire.c
bacula/src/stored/bacula-sd.conf.in

index 29b91e849e7ecdae48aa155df6ca729fed6bfaf1..b99fb56d573402789c90287a3002a311b5b59ec1 100644 (file)
@@ -416,17 +416,19 @@ bool release_device(JCR *jcr)
    /* Fire off Alert command and include any output */
    if (jcr->device->alert_command) {
       POOLMEM *alert;
-      int status;
+      int status = 1;
       BPIPE *bpipe;
       char line[MAXSTRING];
       alert = get_pool_memory(PM_FNAME);
       alert = edit_device_codes(jcr, alert, jcr->device->alert_command, "");
       bpipe = open_bpipe(alert, 0, "r");
-      free_pool_memory(alert);
-      while (fgets(line, sizeof(line), bpipe->rfd)) {
-         Jmsg(jcr, M_INFO, 0, _("Alert: %s"), line);
+      if (bpipe) {
+        free_pool_memory(alert);
+        while (fgets(line, sizeof(line), bpipe->rfd)) {
+            Jmsg(jcr, M_INFO, 0, _("Alert: %s"), line);
+        }
+        status = close_bpipe(bpipe);
       }
-      status = close_bpipe(bpipe);
       if (status != 0) {
         berrno be;
         be.set_errno(status);
index a083e3b5f35a551939d7135a31533a76611cc74a..1b58851c65ebbbc7595c6ca4534a84374efbabf0 100644 (file)
@@ -54,6 +54,10 @@ Device {
 #  AlwaysOpen = yes;
 #  RemovableMedia = yes;
 #  RandomAccess = no;
+## Changer Command = "@scriptdir@/mtx-changer %c %o %S %a %d"
+## Changer Device = /dev/sg0
+## AutoChanger = yes
+## Alert Command = "sh -c 'tapeinfo -f %c | grep TapeAlert'"
 #}
 
 #