#!/bin/ksh
#
# Yee Hsu
# 05/07/2000
#
# backup will backup all directories and sub-directories with all their
# contents into the folder ./backup
# it will create a compressed TAR file for each directory in the parent
# this backup algorithm saves much space as files are compressed
echo "Performing full backup on $HOME"
echo "Do not interrupt."
echo ""
cd $HOME
rm -rf $HOME/mail/sent-mail
echo "removing old backups..."
chmod -R +w ./backup
rm -rf $HOME/backup
echo "copying and backing up all files..."
mkdir -p $HOME/backup
cp -f -p $HOME/.cshrc $HOME/backup
cp -f -p $HOME/.login $HOME/backup
FILES=`/bin/ls`
for file in ${FILES[@]} ; do
if [ $file != "backup" -a -d $file ] ; then
echo "backing up $file/ as $file.tar.gz"
tar -zcf $HOME/backup/$file.tar.gz $file
fi
done
echo "creating /tmp/yeehsu.tar file for ftp backup..."
tar cf /tmp/yeehsu.tar ./backup
chmod 600 /tmp/yeehsu.tar
ln -s /tmp/yeehsu.tar ./backup/yeehsu.tar
chmod -R -w $HOME/backup
echo "done."
exit 0;
# ========================================================================
# :::::::::: BELOW THIS LINE IS OLD BACKUP ROUTINE ::::::::::::::::::::::
# ========================================================================
# backup will backup all directories and sub-directories with all their
# contents into the folder ./backup
# Backups should be made at least once a month to insure file
# integrety and anew.
echo "Performing full backup on $HOME"
echo "Do not interrupt."
echo ""
cd $HOME
echo "removing old backups..."
chmod -R +w ./backup
rm -rf $HOME/backup
echo "copying and backing up all files..."
mkdir -p $HOME/backup
FILES=`/bin/ls -A`
for file in ${FILES[@]} ; do
if [[ $file != "backup" ]] ; then
cp -R -f -p $file backup
fi
done
rm -rf $HOME/backup/mail/sent-mail
chmod -R -w ./backup
echo "creating /tmp/yeehsu.tar file for ftp backup..."
mkdir /tmp/yeehsu
tar cf /tmp/yeehsu/yeehsu.tar ./backup
chmod 600 /tmp/yeehsu/yeehsu.tar
echo "done."
exit 0;