Backup Script weird tar message
Dubh Aingeal
ubuntu at dubh-aingeal.com
Sun Feb 3 18:38:17 UTC 2008
So I am working on a shell script to do a incremental backups. The
script basically makes a full monthly backup then once a week makes
another full back up with daily incremental backups. To limit the
storage amount of backups, the script rewrites the weekly/daily backups.
Eventually I want to add exclusions into it but that will be later
(unless someone has some suggestions now). :p When I run the script to
test it I get this message:
/bin/tar: Removing leading `/' from member names
I'm not sure whats causing it. I'm hoping some fresh eyes might see
where I made my error.
The script looks like this:
#!/bin/sh
# full and incremental backup script
#Change the 5 variables below to fit your computer/backup
COMPUTER=executioner # name of this computer
DIRECTORIES="/home/aingeal" # directories to backup
BACKUPDIR=/backups # where to store the backups
TIMEDIR=/backups/last-full # where to store time
of full backup
TAR=/bin/tar # name and
location of tar
#You should not have to change anything below here
PATH=/usr/local/bin:/usr/bin:/bin
DOW=`date +%a` # Day of the week e.g. Mon
DOM=`date +%d` # Date of the Month e.g. 27
DM=`date +%d%b` # Date and Month e.g. 27Sep
# Monthly full backup
if [ $DOM = "01" ]; then
NEWER=""
$TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DM.tar $DIRECTORIES
fi
# Weekly full backup
if [ $DOW = "Sun" ]; then
NEWER=""
NOW=`date +%d-%b`
# Update full backup date
echo $NOW > $TIMEDIR/$COMPUTER-full-date
$TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES
# Make incremental backup - overwrite last weeks
else
# Get date of last full backup
NEWER="--newer `cat $TIMEDIR/$COMPUTER-full-date`"
$TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES
fi
More information about the ubuntu-users
mailing list