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

NAME
checkbashisms - check for bashisms in /bin/sh scripts SYNOPSIS
checkbashisms script ... checkbashisms --help|--version DESCRIPTION
checkbashisms, based on one of the checks from the lintian system, performs basic checks on /bin/sh shell scripts for the possible presence of bashisms. It takes the names of the shell scripts on the command line, and outputs warnings if possible bashisms are detected. Note that the definition of a bashism in this context roughly equates to "a shell feature that is not required to be supported by POSIX"; this means that some issues flagged may be permitted under optional sections of POSIX, such as XSI or User Portability. In cases where POSIX and Debian Policy disagree, checkbashisms by default allows extensions permitted by Policy but may also provide options for stricter checking. OPTIONS
--help, -h Show a summary of options. --newline, -n Check for "echo -n" usage (non POSIX but required by Debian Policy 10.4.) --posix, -p Check for issues which are non POSIX but required to be supported by Debian Policy 10.4 (implies -n). --force, -f Force each script to be checked, even if it would normally not be (for instance, it has a bash or non POSIX shell shebang or appears to be a shell wrapper). --extra, -x Highlight lines which, whilst they do not contain bashisms, may be useful in determining whether a particular issue is a false posi- tive which may be ignored. For example, the use of "$BASH_ENV" may be preceded by checking whether "$BASH" is set. --version, -v Show version and copyright information. EXIT VALUES
The exit value will be 0 if no possible bashisms or other problems were detected. Otherwise it will be the sum of the following error val- ues: 1 A possible bashism was detected. 2 A file was skipped for some reason, for example, because it was unreadable or not found. The warning message will give details. SEE ALSO
lintian(1). AUTHOR
checkbashisms was originally written as a shell script by Yann Dirson <dirson@debian.org> and rewritten in Perl with many more features by Julian Gilbey <jdg@debian.org>. DEBIAN
Debian Utilities CHECKBASHISMS(1)
All times are GMT -4. The time now is 07:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy