2 Chapter 15. How to use a wrapper
3 Prev Part III. HOWTOs Next
5 -------------------------------------------------------------------------------
7 Chapter 15. How to use a wrapper
16 XML-conversion; Updates
22 Refer to http://www.amanda.org/docs/howto-wrapper.html for the current version
27 The script used in this document is not part of the official AMANDA release.
28 The AMANDA core team does not take any responsibility for this script.
29 This is a mini-howto explaining how to control other running tasks on a server
30 where the AMANDA software is used to backup data.
31 Problem : Lots of software is picky about their datafiles being backed up while
32 the files are in use. It sometimes is even necessary to know the state of the
33 datafiles at the moment of backup so that when restoring you know exactly
34 *what* you are restoring. And most of the time there are dependencies between
35 the datafiles as well (for instance, the pure datafiles and the controlfiles of
37 The solution is actually quite simple; you just use a custom made backupscript
38 instead of the standard tar command. Inside this tar command, you do some
39 necessary processing before executing the tar command and - if necessary - do
40 some more processing. This way, you can easily stop an Oracle database, tar the
41 files, send them to the tape server and restart the Oracle database. This of
42 course is just an example, anything you can do in a shell script can be done.
45 This is the most important step, this script is the work horse of the
46 solution. I've called it /bin/amandatar. You can call it whatever you want
47 though. It's a Perl script, it may not be very pretty code, but it does
48 the job. In the script, an example is given for the backup of a Lotus
53 # Tar wrapper for Amanda's tar.
56 use Getopt::Long qw(:config pass_through);
58 # Obtain directory and file information from the command line.
60 $result = GetOptions (
61 'directory=s' => \$dir,
65 # Check whether Amanda wants to do some administrative task (eg.
67 # or obtain the number of bytes to be backed up)
68 # if file = /dev/null it's an administrative task and most of the time,
70 # processing is necessary.
72 # What you see here is just a log of the backup start time, and
\96 more
74 # the stopping of the domino server
76 if ( $file ne '/dev/null' )
78 if ( $dir eq '/local/notesdata' )
80 system "echo 'Start backup notes at ' >> /var/lib/amanda/runtime" ;
81 system "date >> /var/lib/amanda/runtime";
82 system ( "/etc/init.d/domino stop >> /var/lib/amanda/runtime" );
86 # The command line is being 'reconstructed'. Necessary because the
88 # call above has stripped the file and directory information.
89 # This is what I meant with 'ugly' code ;-)
91 while ( $ARGV[0] ne '' )
94 unshift ( @NEWARGV, $val, ) ;
98 while ( $NEWARGV[0] ne '' )
101 unshift ( @ARGV, $val ) ;
107 unshift ( @ARGV, '--directory', $dir );
111 unshift ( @ARGV, '--file', $file );
114 if ( $file ne '/dev/null' )
116 system "echo 'Backing up directory ' $dir >> /var/lib/amanda/runtime"
120 # And finally make sure tar is called :-)
121 # (path may differ on your installation)
122 unshift ( @ARGV , "/bin/tar" ) ;
128 # If Notes backup was requested, restart the server.
129 # Log the backup end time.
132 if ( $file ne '/dev/null' )
134 if ( $dir eq '/local/notesdata' )
136 system ( "/etc/init.d/domino start >> /var/lib/amanda/runtime" );
137 system "echo 'End backup notes at ' >> /var/lib/amanda/runtime" ;
138 system "date >> /var/lib/amanda/runtime";
146 On some systems it may be necessary to setuid root the script.
147 2. Rebuild AMANDA so that it uses your newly created script.
148 Download the sources, untar them to a directory. I'm sure there are lots
149 of documents already available on how to do this, so I won't go into too
150 much detail. (Refer to Amanda_Installation_Notes).
153 /usr/local/src # tar -xvzf amanda-source.tar.gz
154 /usr/local/src # cd amanda-version
155 /usr/local/src/amanda-version # ./configure \
157 --prefix=/usr/local \
160 --sbindir=/usr/sbin \
161 --libexecdir=/usr/lib/amanda \
162 --with-configdir=/etc/amanda \
164 --with-gnutar=/bin/amandatar \
165 --with-gnutar-listdir=/var/lib/amanda/gnutar-lists \
166 --with-tmpdir=/tmp/amanda \
167 --with-smbclient=/usr/bin/smbclient \
168 --mandir=/usr/local/man
170 Here, it may be necessary to adjust some paths to match your installation.
171 This setup works on SuSE Linux (also SLES) and MacOSX although you may
172 have to use another binary tar.
173 As you see, you may also "replace" the smbclient if necessary. I haven't
174 yet tested it though. I'll leave it as an exercise for the reader <g>.
176 /usr/local/src/amanda-version # make
177 /usr/local/src/amanda-version # make install
179 Now proceed as with a "normal" installation.
181 -------------------------------------------------------------------------------
184 Chapter 14. AFS HOWTO Home Part IV. Various Information