----- Original Message -----
From: "C Hamel"
To: "SuSE"
Sent: Friday, May 21, 2004 9:01 AM
Subject: [SLE] Backing up /home...?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I have a command sequence...
# cd /home
# tar cSpf - . | (cd /home2 ; tar xvSpf - )
...that puts all of /home in another place & simultaneously unTARs it. What
I
really need is a TAR command that stays tarred, but I have had real problems
debugging my command line! I would like to couple that (in a script) with
the command offered by Ken Schneider, I believe, to delete the older file
before creating the new one. HEEELLLP!! <G>
Thanks!
- --
Here is what I use, might not be pretty, but gets the job done:
searchdate=`date +'%b %e'`
cp -vf /data/Backup/home.tar.gz /data/Backup/home.tar.gz .`date
\+\%y\%m\%d` 2>&1 > /tmp/backup.log
# Make backup of home directory
tar cvzf /data/Backup/home.tar.gz /home >> /tmp/backup.log
# Check for any backups over 30 days old
find /data/Backup/home* -mtime +30 -exec ls {} \; >> /tmp/backup.log
# Delete any backups over 30 days old
find /data/Backup/home* -mtime +30 -exec rm {} \; >> /tmp/backup.log
# mail me the log
mail somewhere@somebody.com -s "Backup Report for $searchdate" <
/tmp/backup.log
YMMV on the above
Rob