Amanda-Users

Re: ammkvtapes.sh

2005-11-16 04:16:03
Subject: Re: ammkvtapes.sh
From: Paul Bijnens <paul.bijnens AT xplanation DOT com>
To: sgw AT amanda DOT org
Date: Wed, 16 Nov 2005 10:08:33 +0100
Stefan G. Weichinger wrote:

This script is intended to help generating the necessary structures for a vtape-setup, creating the various virtual tapes and slots etc.

I dug up my latest version and post it here without further testing, please only use it after you have read the code.

OK, that's what I did.



...
if [ -d $VTAPE_DIR ]; then
        echo "found existing tape-dir at " $VTAPE_DIR
        if [ $FORCE_DEL = "1" ]; then
                echo "ATTENTION - force-flag set !!!"
        #       rm -fR $VTAPE_DIR

In the production environment, I guess the comment sign needs to be removed.

...
TAPELIST="$CUR_CONF_DIR/tapelist"

if [ -d $TAPELIST ]; then

Shouldn't that be a test for file instead:  if [ -f $TAPELIST ] ?


...

for n in 1 to $NUM_TAPES
do
         mkdir -p $VTAPE_DIR/slot${n}
         chmod -v 750 $VTAPE_DIR/slot${n}
         rm -f $VTAPE_DIR/data
         ln -s $VTAPE_DIR/slot${n} $VTAPE_DIR/data
         $AMLABEL $CONF daily${n} slot ${n}

This has the string "daily" hardcoded.  It should somehow get the
labelstring reg.exp. like "^daily[0-9]*' and convert that into
a fixed part + variable number.  That's too difficult for me at this
time of the day.
Alternatively, you could supply a string to this script with
a placeholder for the number, like "ammkvtapes.sh config daily0",
and let the number increment automatically.
Note that the default config for many distro's is "Dailyset1" and
the labelstring has something like "Dailyset1[0-9]*', which in
this case should not increment the '1' which should be fixed.
As, said, too difficult at this time of the day.

...

amtape $CONFIG show

echo "OK"

Be careful here:  "amtape show" advances the changer by one slot.
And because all the vtapes are new tapes, amanda accepts any tape.
That would result in slot 2 being the first one to dump to, skipping
slot 1.  Not an error, but strange.
I would add a cmd "amtape $CONFIG reset" after this line, so that
slot 1 is loaded again.

I my current chg-disk setup, I execute a "amtape config reset"
just before the amdump each night.  Just to avoid having it skip
some tape, because I executed "amtape show" during the day.
Once you have a complete tapecycle, it does not matter anymore,
because then amanda advances to oldest unused tape.



--
Paul Bijnens, Xplanation                            Tel  +32 16 397.511
Technologielaan 21 bus 2, B-3001 Leuven, BELGIUM    Fax  +32 16 397.512
http://www.xplanation.com/          email:  Paul.Bijnens AT xplanation DOT com
***********************************************************************
* I think I've got the hang of it now:  exit, ^D, ^C, ^\, ^Z, ^Q, ^^, *
* F6, quit, ZZ, :q, :q!, M-Z, ^X^C, logoff, logout, close, bye, /bye, *
* stop, end, F3, ~., ^]c, +++ ATH, disconnect, halt,  abort,  hangup, *
* PF4, F20, ^X^X, :D::D, KJOB, F14-f-e, F8-e,  kill -1 $$,  shutdown, *
* init 0, kill -9 1, Alt-F4, Ctrl-Alt-Del, AltGr-NumLock, Stop-A, ... *
* ...  "Are you sure?"  ...   YES   ...   Phew ...   I'm out          *
***********************************************************************



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