Sponsored Content
Full Discussion: Offsite Backup Solution
Operating Systems AIX Offsite Backup Solution Post 302352422 by bakunin on Friday 11th of September 2009 08:47:20 AM
Old 09-11-2009
There are two different problems, lets discuss it one by one:

I suppose the data reside on some sort of SAN device. To read and write 20GB of data is a matter of some minutes, maybe a quarter hour (if things go really wrong). We can afford to have the backup reside on the local machine.

We need a script, which does the following:

- stop the application
- tar (and gzip?) the data to the (local) backup destination
- start up the application again

The script should issue some sort of alert (alerting a management system like Patrol/HP-Openview/etc. or mail to root or whatever) if anything goes wrong.

Then lets turn our attention to the backup server. We need a script there which does the following:

- contact the server to be backed up.
- pull the file the server has already created that day
- delete old backups on the system if we want to have only a certain number of generations online

Again, if anything goes wrong the system should complain somehow.

It is good to have the taking and the pulling over of the backup NOT tied together (that would have been possible) because this way you can take the backup when the client has time and then pull over the backup when the backup system has time.

Both these scripts will be put into crontab to run daily (or whatever timely pattern you want them to run).

Lets start with the scripts. Since i don't know your exact environment these scripts are a sketch of course. You will have to fill in the details yourself:

Code:
#! /bin/ksh
# backup script. Takes a copy of some data, with tar and stops/restarts the
# application

function send_alert
{
# This will send all the alerts. It gets some message, like "file not found", 
# and issues an alert with exactly this message. Probably you will have to
# adapt this function to suit your needs, i just output at <stderr> for
# demonstration purposes

typeset msg="$1"

print -u2 "$msg"

return 0
}




function take_backup
{
typeset destination="$1"
typeset source="$2"

tar -cvf ${destination} ${source}
# alternatively, with compression:
# tar -cvf - ${source} | gzip -9 > ${destination}

if [ "$?" -ne 0 ] ; then
     send_alert "problem writing backup file"
     return 1
fi

return 0
}




function stop_application
{

<...whatever is necessary to stop the app...>

# control if the app is really stopped. If not we raise an alert and main() will exit:
if [ $(ps -fe | grep -c <application>) -gt 1 ] ; then
     send_alert "Not able to stop application"
     return 1
fi

return 0
}




function start_application
{

<...whatever is necessary to start the app...>

# control if the app is really started. If not we raise an alert and main() will
# exit. Note that the test if there is at least one process running is just an
# example. Replace the test with whatever would make you sure the app is
# running again:
sleep 30     # give things time to settle

if [ $(ps -fe | grep -c <application>) -lt 2 ] ; then
     send_alert "Not able to start application"
     return 1
fi

return 0
}



# -------- main()
# The following is necessary, we will run in cron once. You might want to set
# other necessary environment variables here too
typeset PATH=<whatever you need>
typeset TERM=<whatever you need>
export TERM; export PATH

typeset approot="/path/to/your/data"
typeset budest="/path/to/backup/destination"
typeset today="$(date '+%Y%m%d')"   # we will use this to name the backup files

stop_application
if [ "$?" -ne 0 ] ; then
     exit 1
fi

take_backup ${budest}/backup_${today}.tar $approot
if [ "$?" -ne 0 ] ; then
     exit 1
fi

start_application
if [ "$?" -ne 0 ] ; then
     exit 1
fi

exit 0

Note that this is really a sketch: for instance there is no provision to delete old backup files when they are no longer necessary. Ideally the script for the backup server should do this after pulling over the file successfully. Still it would probably be nice to have the last backup generation on the originating server in case we have to restore something, so there is room for some scripting for you.

Lets turn to the matter of software installation: You find a pinned thread with important URLs at the top of this forum. Among these URLs is IBMs "Linux toolbox for AIX", where you can download all the necessary tools already packaged in rpm-format.

You first have to install the rpm installer itself, which is a package in AIX' native bff-format. (AIX has its own packaging format.)

To install packages in bff-format:

- copy the downloaded packages to a directory
- change to this directory and issue "inutoc .", which will create a file ".toc"
- issue "installp -ac -d. -Y -g <package_name>" to install a package


To install packages in rpm-format:

- copy the downloaded packages to a directory
- change to this directory
- issue "rpm -i <packagefile>" to install to package

I hope this helps.

bakunin
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

offsite backup for solaris

any hot sites out there for backup of a sun unix server. can't verify my tape backups and want a "disaster recovery" option (1 Reply)
Discussion started by: jbksman
1 Replies

2. UNIX for Advanced & Expert Users

enterprise backup solution

We are using sun_sparc solaris 2.5.1 with oracle database 8.0.5 We are considering to buy for buying backup software for this purpose . Our systems integrator says veritas could not be installed due to some technical reasons (they are veritas authorised dealer) . And is suggesting Netvault... (3 Replies)
Discussion started by: Hitesh Shah
3 Replies

3. Solaris

Sun and backup solution

My company is in the process of building a new datacenter and I am responsible for setting up the backup environment (everything from racking to implementation). I guess it is pretty basic but I don't have much experience with the initial setup. What we have so far is a SunV890 (backup server), Sun... (1 Reply)
Discussion started by: Jshwon
1 Replies

4. AIX

Backup solution

Hello, I'm looking for a backup solution for my system. I have 3 AIX virtual partitions running on a IBM p5 server. Each partition has it's data on a DS4700 storage server. Also, I have a RedHat running on an IBM p720. This server has the tape hardware. I would like to know if I can backup from... (4 Replies)
Discussion started by: enzote
4 Replies

5. Linux

Backup solution

Hi all, i am not sure whether i selected the right topic or not, so excuse me, well i am mainly a Windows admin, but i do *NIX administration from time to time, for now i need to use an open source solution for backup windows environment mainly, i spent last days playing with bacula and backupPC,... (0 Replies)
Discussion started by: XP_2600
0 Replies

6. Solaris

OpenSource / Free backup and restore solution for Solaris 10

Is there any free /opensource backup&restore solution available for solaris10 i want to backup Solaris10 machine with oracle 9 version. (0 Replies)
Discussion started by: kashif_islam
0 Replies

7. Shell Programming and Scripting

Considered basic but advanced outcome (Custom Backup Solution)

Ive a problem that I'm reaching out for help. Ive written (With bits and pieces) of script that is not running as expected or is having an issue causing processes to spiral out of control. The script does this: Unloads a UV database server Tars up a few folders Transfers the file to... (11 Replies)
Discussion started by: coastdweller
11 Replies

8. UNIX for Dummies Questions & Answers

Backup solution using rsync

Hello All, I am looking at a fast way to script some backups. I am looking at using rsync to do the leg work. I am having a hard time conceiving a script though. I have a tree with subfolders within subfolders. I was looking at the /xd option to parse the tree. Directory of k:\ ... (4 Replies)
Discussion started by: jvamos
4 Replies
All times are GMT -4. The time now is 12:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy