Sponsored Content
Top Forums Shell Programming and Scripting Considered basic but advanced outcome (Custom Backup Solution) Post 302774643 by coastdweller on Saturday 2nd of March 2013 06:05:39 PM
Old 03-02-2013
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 another server

Reloads the UV database

Simple actually but I'm lost in its dysfunction.

Code:
#!/bin/sh
# Unload the UV Database
# Suspend the database
uv -admin -L
# Validate the database
uv -admin -R
#Sync any cached data back to disk
sync
# What is the script backing up exactly
backup_files="/home /etc /u2 /usr/spool/uv /boot /opt"
# Where is it backing up to
dest="/backup"
# Create a daily variable for the archive filename and add the hostname to it
day=$(date +%A)
hostname=$(hostname -s)
# Find which week of the month 1-4 it is.
day_num=$(date +%d)
if (( $day_num <= 7 )); then
        week_file="$hostname-week1.tgz"
elif (( $day_num > 7 && $day_num <= 14 )); then
        week_file="$hostname-week2.tgz"
elif (( $day_num > 14 && $day_num <= 21 )); then
        week_file="$hostname-week3.tgz"
elif (( $day_num > 21 && $day_num < 32 )); then
        week_file="$hostname-week4.tgz"
fi
# Find if the Month is odd or even.
month_num=$(date +%m)
month=$(expr $month_num % 2)
if [ $month -eq 0 ]; then
        month_file="$hostname-month2.tgz"
else
        month_file="$hostname-month1.tgz"
fi
# Create archive filename.
if [ $day_num == 1 ]; then
        archive_file=$month_file
elif [ $day != "Saturday" ]; then
        archive_file="$hostname-$day.tgz"
else
        archive_file=$week_file
fi
# Print start status message.
echo
echo "Backing up $backup_files to $dest/$archive_file"
date
# Backup the files using tar.
tar czf $dest/$archive_file $backup_files
# Print end status message.
echo
echo "Backup finished"
date
# Long listing of files in $dest to check file sizes.
ls -lh $dest/
# Release the Database
uv -admin -U

The result is that it will write to a local server (CIFS) but its performance is so bad it never completes or takes down the server.

//location /backup cifs rw,user=domain/user,password=PASS,uid=1000,gid=1000 0 0

I end up with multiple uvsh processes running at 100 percent, or 50 percent. Yes I'm stumped here, I expect this to be simple but its not acting right.
 

7 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. AIX

Offsite Backup Solution

I'm looking for a program or some way to backup my server to another location onto another server. Does anyone have any ideas? What utility, server O/S(I would like to use Linux RH or CentOS)? Whats the best way to do this? I am fairly new with Unix. Thanks in advance (6 Replies)
Discussion started by: ITAdmin08
6 Replies

5. Red Hat

RHEL 5 basic vs advanced

Hello there to the community Question 1 : how can you tell if the RHEL 5 version you have is BASIC or ADVANCED. ? Question 2 : except for virtualization limits on BASIC RHEL which is 2 physical CPUs and 4 virtual guest (redhat virtualization , not VMWARE) and Advanced allows unlimited CPU and... (4 Replies)
Discussion started by: dplinux
4 Replies

6. 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

7. 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
XDIFF_FILE_BPATCH(3)							 1						      XDIFF_FILE_BPATCH(3)

xdiff_file_bpatch - Patch a file with a binary diff

SYNOPSIS
bool xdiff_file_bpatch (string $file, string $patch, string $dest) DESCRIPTION
Patches a $file with a binary $patch and stores the result in a file $dest. This function accepts patches created both via xdiff_file_bdiff(3) and xdiff_file_rabdiff(3) functions or their string counterparts. PARAMETERS
o $file - The original file. o $patch - The binary patch file. o $dest - Path of the resulting file. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 xdiff_file_bpatch(3) example The following code applies binary diff to a file. <?php $old_version = 'archive-1.0.tgz'; $patch = 'archive.bpatch'; $result = xdiff_file_bpatch($old_version, $patch, 'archive-1.1.tgz'); if ($result) { echo "File patched"; } else { echo "File couldn't be patched"; } ?> NOTES
Note Both files ($file and $patch) will be loaded into memory so ensure that your memory_limit is set high enough. SEE ALSO
xdiff_file_bdiff(3), xdiff_file_rabdiff(3). PHP Documentation Group XDIFF_FILE_BPATCH(3)
All times are GMT -4. The time now is 03:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy