Firstly, as you will see in the script that I have quoted in this
message, I was wanting to create a set of gzipped tar archives for a
series of directories all under a couple of trees.
My dilemma was first finding out that tar doesn't like anything over
2GB that isn't a streamed device such as a tape store. I have two hard
drives installed in the network server, and hda6 holds all the data
that I want to automatically backup.
The idea is that this script will take everything on hda6 and create
the archives on hdb6 neat 'n' tidy, retaining a very similar directory
structure. I then copy ala 'Samba' all this to a windoze workstation
to be burnt off on DVD's <nice>, which are then taken off site <sain>.
We have a couple of MAC's on the network and numerous erroneous files
with filenames that have been munged, and I can't seem to be able to
create a folder named 'con' for some dumb ass microshit reason. So
packed archives it has to be, otherwise I have to manually drive the
copy process, which is such a 'soft killer', stop/start/stop/......
arrghhhh
* Secondly, upon further contemplation, is this the best way to go
about it? Thoughts?
#!/bin/bash
#
##############################
# "auto_archiva v1.0"
# Nicks script for automatically
# creating backup archives of all
# data in the users and ibay directories
# that are located in
# /home/e-smith/files/users/*
# tar and gzip them
# This script will then copy them
# to hdb for retrieval.
# 04/03/03
##############################
currentdir=${PWD}
userdir=/home/e-smith/files/users/
ibaydir=/home/e-smith/files/ibays/
targetdir=/mnt/superbackup/auto_archiva/
scriptname=`basename $0`
echo $'\a'
echo $scriptname running...
echo; df; echo
[ ! -d "$targetdir" ] && \
mkdir $targetdir
echo Cleaning up...
echo Ready ; echo
rm -rf $targetdir*
###
### Do the users directories first
###
echo Starting on user shares; echo
for file in `ls "$userdir"`
do
echo Creating $targetdir$file
mkdir $targetdir$file
echo Entering $userdir$file/home/
cd $userdir$file/home
[ ! -f backuplog ] && touch backup.log
echo -e "Backed up from $userdir$file/home/ \
\n `ls -alh` \n\n `date` \n\n" >> backup.log
cp backup.log $targetdir$file
# tar and gzip 'em up
cd ../
echo Creating $file.tar.gz in $targetdir$file/
tar -czf $targetdir$file/$file.tar.gz *
echo
done
echo
###
### Now do the ibays
###
echo Starting on ibays; echo
for file in `ls "$ibaydir"`
do
echo Creating $targetdir$file
mkdir $targetdir$file
echo Entering $ibaydir$file/
cd $ibaydir$file
[ ! -f backuplog ] && touch backup.log
echo -e "Backed up from $ibaydir$file \
\n `ls -alh` \n\n `ls -alh files` \n\n `date` \n\n" >> backup.log
cp backup.log $targetdir$file
# tar and gzip 'em up
echo Creating $file.tar.gz in $targetdir$file/
tar -clzf $targetdir$file/$file.tar.gz *
echo
done
echo
echo Re-entering $currentdir
cd $currentdir
echo; echo Process finished: `date`
echo
#rm -rf "$targetdir"*
exit
~
~
another nice one
_________________
"We spend our whole lives coming to terms with things
...and it never ends"
another nice one
_______________