Results 1 to 10 of 10

Thread: incremental backup script

Threaded View

  1. #1
    Join Date
    Mar 2013

    incremental backup script

    So I found this 13 year old script and thought I'd use it.
    I did my 4 edits and was wondering if this will do the job?
    # 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=ubuntu                                                 # name of this computer
    DIRECTORIES="/home"                                             # directoris to backup
    BACKUPDIR=/media/temporary/backup                        # where to store the backups
    TIMEDIR=/media/temporary/backup/last-full                 # where to store time of full backup
    TAR=/bin/tar                                                         # name and locaction of tar
    #You should not have to change anything below here
    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
    # On the 1st of the month a permanet full backup is made
    # Every Sunday a full backup is made - overwriting last Sundays backup
    # The rest of the time an incremental backup is made. Each incremental
    # backup overwrites last weeks incremental backup of the same name.
    # if NEWER = "", then tar backs up all files in the directories
    # otherwise it backs up files newer than the NEWER date. NEWER
    # gets it date from the file written every Sunday.
    # Monthly full backup
    if [ $DOM = "01" ]; then
                    $TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DM.tar $DIRECTORIES
    # Weekly full backup
    if[ $DOW ="Sun"];then
                    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
                    # Get date of last full backup
                    NEWER="--newer `cat $TIMEDIR/$COMPUTER-full-date`"
                    $TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES
    Basicly I want to backup /home to my external drive once a day everyday and only backing up new or changed files and folders in /home except on sundays and the 1st of every month when I want a full new backup. Now I don't really need that and could easily go for a weekly incremental backup on sundays with a full backup on the 1st of every month but this is the only full script I've found since most people send noobs like me to guides that would teach us how to make these our selves.

    If anyone have any scripts they would like to share with me that does something close to this I'd love to check it out.

    Don't bother telling me about programs, apps or stuff like that since I already know of loads of other easier ways to do this. I want to learn this script buisness.

    EDIT: Also this script is supposed to be called "something.cron" and be placed in "/etc/cron/daily"
    Last edited by kman3107; March 10th, 2013 at 09:28 PM. Reason: And I know I misspelled incremental in title :p


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts