Bacula-users

Re: [Bacula-users] Way to check ANY bacula volume on disk

2015-08-12 10:14:30
Subject: Re: [Bacula-users] Way to check ANY bacula volume on disk
From: Andrey Tataranovich <tataranovich AT gmail DOT com>
To: Bacula Users <bacula-users AT lists.sourceforge DOT net>
Date: Wed, 12 Aug 2015 17:12:27 +0300
On Wed, 12 Aug 2015 10:37:13 -0300 (BRT)
Heitor Faria <heitor AT bacula.com DOT br> wrote:

> Hello Andrey: I think it was the developer option not to terminate de
> bls on error if this kind of message / alert happens, after all it's
> not pretty much it's purpose. I think you can change both things with
> a little shell script tricks (if, grep "Block checksum mismach",
> change $?). About redirection:
> http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-3.html

Checking output for "Block checksum mismatch" string isn't enough. Error
can be different and due to lack of correct exit code I can't be
confident about volume consistency.

My suggestion based on kiss traditions:

 - 0 exit code if no error or warning
 - all error/warning output to stderr

I this case volume checking is pretty easy:

for i in $(find /bacula/backup/ -type f -mtime +1 -a -mtime -3)
do
  OUTPUT=$(bls -j $i >/dev/null)
  if [ $? != 0 ]; then
    echo "-> Volume $i is damaged"
    echo $OUTPUT
  fi
done

-- 
WBR, Andrey Tataranovich

------------------------------------------------------------------------------
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users