#!/bin/sh
# full and incremental backup script
# created 07 February 2000
# Based on a script by Daniel O'Callaghan
# and modified by Gerhard Mourani
#Change the 5 variables below to fit your computer/backup
COMPUTER=venom # name of this computer
DIRECTORIES="/home/ammar/" # directoris to backup
BACKUPDIR=/media/backup # where to store the backups
TIMEDIR=/media/backup/last-full # where to store time of full backup
TAR=/bin/tar # name and locaction of tar
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
if [ $DOM = "01" ]; then
NEWER=""
$TAR $NEWER -cfz $BACKUPDIR/$COMPUTER-$DM.tar.gz $DIRECTORIES
fi
if [ $DOW = "Sun" ]; then
NEWER=""
NOW=`date +%d-%b`
# Update full backup date
echo $NOW > $TIMEDIR/$COMPUTER-full-date
$TAR $NEWER -cfz $BACKUPDIR/$COMPUTER-$DOW.tar.gz $DIRECTORIES
else
# Get date of last full backup
NEWER="--newer `cat $TIMEDIR/$COMPUTER-full-date`"
$TAR $NEWER -cfz $BACKUPDIR/$COMPUTER-$DOW.tar.gz $DIRECTORIES
fi
Combining it with crontab and see how powerfull it is :)
enjoy(tm)
No comments:
Post a Comment