Bacula-users

Re: [Bacula-users] error message in runbefore job

2011-05-04 15:05:56
Subject: Re: [Bacula-users] error message in runbefore job
From: Joris Heinrich <jhn AT malin-easy DOT de>
To: bacula-users AT lists.sourceforge DOT net
Date: Wed, 04 May 2011 21:03:28 +0200

Am 04.05.11 20:33, schrieb Jérôme Blion:
Le 04/05/2011 14:40, Konstantin Khomoutov a écrit :
On Wed, 04 May 2011 13:23:55 +0200
Joris Heinrich<jhn AT malin-easy DOT de>  wrote
i run an job with an mysql backup and an ClientRunBeforeJob like this
example:


Job {
     Name                = test-client
     Client              = tool-client
     JobDefs             = dbdump
     FileSet             = db
     ClientRunBeforeJob  = "/etc/bacula/scripts/manage_mysql_backup"

In the client script, is included an ssh connect to various other
machines. Some machines are new installed, and the host-verification
will be fail:

04-May 01:00 tool-client JobId 291204: ClientRunBeforeJob: Host key
verification failed.

The bacula job it self brings an OK Message per email.

Now my qestion, it is possible to parse the message and change the
job-status to error or warning..
Create another script, say,
/etc/bacula/scripts/manage_mysql_backup2
which should look like this:

#!/bin/sh
/etc/bacula/scripts/manage_mysql_backup 2>&1 \
   | grep "verification failed"&&  exit 1

Then use the new wrapper script for ClientRunBeforeJob.
Now if the original script generates that error message, the wrapper
script would exit with non-zero code, failing the job.
Hello,

The workaround if far than enough.
The real solution is to modify the script to end with an exit code 
greater than 0 when something wrong happens.
It means you will have to modify the script to manage all possible errors.

HTH.
Jerome Blion.

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users
Hello Jerome,
exactly this is what i implemented. I included set -e in the script and modified every action with exit codes greater then 0.

Runs perfect...

Thanks for help


Best regards

JHN
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users