Bacula-users

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

2011-05-04 14:36:13
Subject: Re: [Bacula-users] error message in runbefore job
From: Jérôme Blion <jerome.blion AT free DOT fr>
To: bacula-users AT lists.sourceforge DOT net
Date: Wed, 04 May 2011 20:33:24 +0200
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