Amanda-Users

Re: Do not start Job if label not correct?

2008-04-02 07:25:23
Subject: Re: Do not start Job if label not correct?
From: Jean-Louis Martineau <martineau AT zmanda DOT com>
To: Theodotos Andreou <theo AT francoudi DOT com>
Date: Wed, 02 Apr 2008 07:18:26 -0400
Theodotos Andreou wrote:
Tony van der Hoff wrote:
On 2 Apr at 9:47 Theodotos Andreou <theo AT francoudi DOT com> wrote in message
<47F3482A.20907 AT francoudi DOT com>

Is there a way to tell a Backup job not to start if there is no correct
label found on the changer? I do not want to use amflush later because
/amandadumps is too small to host all level 0 images during a monthly
archival backup.


I do this:

----------------------------------------------------
#!/bin/bash
#Check tape, and only run backup if successful

DUMP=HomeDumps

/usr/sbin/amcheck -w $DUMP
if [ $? -eq 0 ]
then
    #retension tape
    mt retension

    #run backup for group
    /usr/sbin/amdump $DUMP

    #verify the tape
    echo Verifying ${DUMP}
    /usr/sbin/amverify $DUMP
else
    echo Failed $DUMP
fi
----------------------------------------------------

Customise to suit...
This will force a non amanda tape or a tape from another amanda job to be used by MonthlyJob. What I want is not to start MonthlyJob if there are no labels for it in the changer. I was hoping that there is native support for this in the configuration but I guess I will have to script this behavior myself.

Excerpt from amcheck man page:
      -w
          Enables a DESTRUCTIVE check for write-protection on the tape
          (which would otherwise cause the subsequent amdump to fail).
          If the tape is writable, this check causes all data after
          the tape label to be erased. If the label_new_tapes option
          is enabled, this check may ERASE any non-Amanda tape in the
          drive or changer. The check enable the tape tests on the
          server host and is only made if the tape is otherwise
          correct.

A non amanda tape will be used only if "label_new_tapes" is set in amanda.conf. Don't set it if you don't want it.
 A tape from another config will never be overwritten

You might want to use 'amcheck -tw MonthlyJob' if want to only test the tape, otherwise a failure on a client will abort the job.

Jean-Louis


<Prev in Thread] Current Thread [Next in Thread>