Tuesday, March 11, 2008

Backup ..

This is an old (8th years already) sh script for backup your linux machine, Using TAR for doing a full backup and daily incremental backup, yup still the best for me :)

# 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

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

if [ $DOW = "Sun" ]; then
NOW=`date +%d-%b`

# Update full backup date
echo $NOW > $TIMEDIR/$COMPUTER-full-date


# Get date of last full backup
NEWER="--newer `cat $TIMEDIR/$COMPUTER-full-date`"

Combining it with crontab and see how powerfull it is :)

No comments:

Post a Comment