From 5674ba242a47f54a50c5bc6af8af0a60df70208d Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 14 Aug 2004 10:22:50 +0000 Subject: [PATCH] Print error if Alert command fails + doc git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1527 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/acquire.c | 12 +++++++----- bacula/src/stored/bacula-sd.conf.in | 4 ++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/bacula/src/stored/acquire.c b/bacula/src/stored/acquire.c index 29b91e849e..b99fb56d57 100644 --- a/bacula/src/stored/acquire.c +++ b/bacula/src/stored/acquire.c @@ -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); diff --git a/bacula/src/stored/bacula-sd.conf.in b/bacula/src/stored/bacula-sd.conf.in index a083e3b5f3..1b58851c65 100644 --- a/bacula/src/stored/bacula-sd.conf.in +++ b/bacula/src/stored/bacula-sd.conf.in @@ -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'" #} # -- 2.39.5