Amanda-Users

Re: Running shell script during backup

2003-07-11 16:29:43
Subject: Re: Running shell script during backup
From: Marc Mengel <mengel AT fnal DOT gov>
To: Kin-Ho Kwan <Kin-Ho.Kwan AT hxti DOT com>
Date: Fri, 11 Jul 2003 15:25:24 -0500
Kin-Ho Kwan wrote:
Since I have to do a "hot backup" on my Oracle database. I just want to know if I can do this in Amanda.

1. Bacup / directory
2. Run shell script to switch Oracle into backup mode
3. Backup /d1 directory
4. Run shell script to switch Oracle back into normal.
5. Backup /d2 directory

What do I have to configure and what file do I have to edit?

The way to do this smoothly in current versions of Amanda is to use a "wrapper" dump script, which is to say:

Instead of using, say, "tar" to make the backup, you use "tar-wrapper",
a script which first does your backup-mode shellscript, then runs tar,
then does the normal-mode shellscript.  Of course the script should
be smart enough to know to do this for the the Oracle area, and just
run "tar" for other areas.

To do this, you do
  ./configure --with-gnutar=/usr/local/bin/gnutar-wrapper ...
and write the gnutar-wrapper script.

In this case, you could probably get away with:

gnutar-wrapper
-------------------------
#!/bin/sh

if [ "x$1" = "x--create" ]
then
    [ "$5" = "/my/oracle/dir" ] && put-oracle-in-backup-mode
    /usr/local/bin/tar "$@"
    [ "$5" = "/my/oracle/dir" ] && put-oracle-in-normal-mode
else
    exec /usr/local/bin/tar "$@"
fi
--------------------------

You can similarly write a wrapper for dump...



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