--- /dev/null
+
+Chapter 15. How to use a wrapper
+Prev Part III. HOWTOs Next
+
+-------------------------------------------------------------------------------
+
+Chapter 15. How to use a wrapper
+
+
+Bert de Ridder
+
+Original text
+
+Stefan G. Weichinger
+
+XML-conversion; Updates
+AMANDA Core Team
+<sgw@amanda.org>
+
+Note
+
+Refer to http://www.amanda.org/docs/howto-wrapper.html for the current version
+of this document.
+
+Note
+
+The script used in this document is not part of the official AMANDA release.
+The AMANDA core team does not take any responsibility for this script.
+This is a mini-howto explaining how to control other running tasks on a server
+where the AMANDA software is used to backup data.
+Problem : Lots of software is picky about their datafiles being backed up while
+the files are in use. It sometimes is even necessary to know the state of the
+datafiles at the moment of backup so that when restoring you know exactly
+*what* you are restoring. And most of the time there are dependencies between
+the datafiles as well (for instance, the pure datafiles and the controlfiles of
+an Oracle database.)
+The solution is actually quite simple; you just use a custom made backupscript
+instead of the standard tar command. Inside this tar command, you do some
+necessary processing before executing the tar command and - if necessary - do
+some more processing. This way, you can easily stop an Oracle database, tar the
+files, send them to the tape server and restart the Oracle database. This of
+course is just an example, anything you can do in a shell script can be done.
+
+ 1. Create the script
+ This is the most important step, this script is the work horse of the
+ solution. I've called it /bin/amandatar. You can call it whatever you want
+ though. It's a Perl script, it may not be very pretty code, but it does
+ the job. In the script, an example is given for the backup of a Lotus
+ Notes Domino server.
+
+ #!/usr/bin/perl
+
+ # Tar wrapper for Amanda's tar.
+ #
+
+ use Getopt::Long qw(:config pass_through);
+
+ # Obtain directory and file information from the command line.
+
+ $result = GetOptions (
+ 'directory=s' => \$dir,
+ 'file=s' => \$file
+ );
+
+ # Check whether Amanda wants to do some administrative task (eg.
+ indexinfo
+ # or obtain the number of bytes to be backed up)
+ # if file = /dev/null it's an administrative task and most of the time,
+ no extra
+ # processing is necessary.
+
+ # What you see here is just a log of the backup start time, and \96 more
+ important
+ # the stopping of the domino server
+
+ if ( $file ne '/dev/null' )
+ {
+ if ( $dir eq '/local/notesdata' )
+ {
+ system "echo 'Start backup notes at ' >> /var/lib/amanda/runtime" ;
+ system "date >> /var/lib/amanda/runtime";
+ system ( "/etc/init.d/domino stop >> /var/lib/amanda/runtime" );
+ }
+ }
+
+ # The command line is being 'reconstructed'. Necessary because the
+ GetOptions
+ # call above has stripped the file and directory information.
+ # This is what I meant with 'ugly' code ;-)
+
+ while ( $ARGV[0] ne '' )
+ {
+ $val = $ARGV[0] ;
+ unshift ( @NEWARGV, $val, ) ;
+ shift @ARGV;
+ }
+
+ while ( $NEWARGV[0] ne '' )
+ {
+ $val = $NEWARGV[0] ;
+ unshift ( @ARGV, $val ) ;
+ shift @NEWARGV;
+ }
+
+ if ( $dir ne '' )
+ {
+ unshift ( @ARGV, '--directory', $dir );
+ }
+ if ( $file ne '' )
+ {
+ unshift ( @ARGV, '--file', $file );
+ }
+
+ if ( $file ne '/dev/null' )
+ {
+ system "echo 'Backing up directory ' $dir >> /var/lib/amanda/runtime"
+ ;
+ }
+
+ # And finally make sure tar is called :-)
+ # (path may differ on your installation)
+ unshift ( @ARGV , "/bin/tar" ) ;
+
+ system ( @ARGV ) ;
+
+ # Postprocessing
+ #
+ # If Notes backup was requested, restart the server.
+ # Log the backup end time.
+ #
+
+ if ( $file ne '/dev/null' )
+ {
+ if ( $dir eq '/local/notesdata' )
+ {
+ system ( "/etc/init.d/domino start >> /var/lib/amanda/runtime" );
+ system "echo 'End backup notes at ' >> /var/lib/amanda/runtime" ;
+ system "date >> /var/lib/amanda/runtime";
+ }
+ }
+
+ exit 0;
+
+ # End script
+
+ On some systems it may be necessary to setuid root the script.
+ 2. Rebuild AMANDA so that it uses your newly created script.
+ Download the sources, untar them to a directory. I'm sure there are lots
+ of documents already available on how to do this, so I won't go into too
+ much detail. (Refer to Amanda_Installation_Notes).
+ fast path :
+
+ /usr/local/src # tar -xvzf amanda-source.tar.gz
+ /usr/local/src # cd amanda-version
+ /usr/local/src/amanda-version # ./configure \
+ --with-user=amanda \
+ --prefix=/usr/local \
+ --exec-prefix=/usr \
+ --bindir=/usr/bin \
+ --sbindir=/usr/sbin \
+ --libexecdir=/usr/lib/amanda \
+ --with-configdir=/etc/amanda \
+ --with-group=disk \
+ --with-gnutar=/bin/amandatar \
+ --with-gnutar-listdir=/var/lib/amanda/gnutar-lists \
+ --with-tmpdir=/tmp/amanda \
+ --with-smbclient=/usr/bin/smbclient \
+ --mandir=/usr/local/man
+
+ Here, it may be necessary to adjust some paths to match your installation.
+ This setup works on SuSE Linux (also SLES) and MacOSX although you may
+ have to use another binary tar.
+ As you see, you may also "replace" the smbclient if necessary. I haven't
+ yet tested it though. I'll leave it as an exercise for the reader <g>.
+
+ /usr/local/src/amanda-version # make
+ /usr/local/src/amanda-version # make install
+
+ Now proceed as with a "normal" installation.
+
+-------------------------------------------------------------------------------
+
+Prev Up Next
+Chapter 14. AFS HOWTO Home Part IV. Various Information
+