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
DATE(1) 						      General Commands Manual							   DATE(1)

NAME
date - print or set the date and time SYNOPSIS
date [-qsu] [[MMDDYY]hhmm[ss]] [+format] OPTIONS
-q Read the date from stdin -s Set the time (implicit for -q or a date string) -u Print the date as GMT -t Use this number of seconds instead of current time EXAMPLES
date # Print the date and time date 0221921610 # Set date to Feb 21, 1992 at 4:10 p.m. DESCRIPTION
With the -q flag or a numeric argument, date sets the GMT time and date. MMDDYY refers to the month, day, and year; hhmmss refers to the hour, minute and second. Each of the six fields must be exactly two digits, no more and no less. date always display the date and time, with the default format for the system. The -u flag request GMT time instead of local time. A format may be specified with a + followed by a printf-like string with the following options: %% % character %A Name of the day %B Name of the month %D mm/dd/yy %H Decimal hour on 2 digits %I Decimal hour modulo 12 on 2 digits %M Decimal minute on 2 digits %S Decimal seconds on 2 digits %T HH:MM:SS %U Decimal week number, Sunday being first day of week %W Decimal week number, Monday being first day of week %X Same as %T %Y Decimal year on 4 digits %Z Time Zone (if any) %a Abbreviated name of the day %b Abbreviated name of the month %c Appropriate date & time (default format) %d Decimal day of the month on 2 digits %e Same as %d, but a space replaces leading 0 %h Same as %b %j Decimal dey of the year on 3 digits %m Decimal month on 2 digits %n Newline character %p AM or PM %r 12-hour clock time with AM/PM %s Number of seconds since the epoch %t Tab character %w Decimal day of the week (0=Sunday) %x Same as %D %y Decimal year on 2 digits SEE ALSO
time(2), ctime(3), readclock(8). DATE(1)
All times are GMT -4. The time now is 02:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy