NSLU2-Linux
view · edit · print · history

HowTo.BackupYourWindowsFilesRemotely History

Hide minor edits - Show changes to markup

March 25, 2008, at 11:21 AM by bjohv052 -- Corrected an error in script prepare_backup.sh
Changed line 237 from:
    $MV $LATEST_MONTHLY $SNAPSHOT/quarterly.0
to:
    $MV $SNAPSHOT/$LATEST_MONTHLY $SNAPSHOT/quarterly.0
Changed line 259 from:
    $MV $LATEST_WEEKLY $SNAPSHOT/monthly.0
to:
    $MV $SNAPSHOT/$LATEST_WEEKLY $SNAPSHOT/monthly.0
Changed line 281 from:
    $MV $LATEST_DAILY $SNAPSHOT/weekly.0
to:
    $MV $SNAPSHOT/$LATEST_DAILY $SNAPSHOT/weekly.0
March 21, 2008, at 06:38 PM by bjohv052 -- Minor corrections
Changed lines 18-19 from:

The setup depends on three bash shell scripts and one text file, one on the source side and two on the remote side. Backup is started by executing run_remote_jobs on the source side. run_remote_jobs will then, via ssh, call the script prepare_backup on the remote side. prepare_backup will prepare backup dirs to receive a new increment (e.g. shift daily.0 to daily.1). After that, run_remote_jobs will perform the actual backup jobs (listed in the file jobs.txt). Finally, run_remote_jobs will call the remote script finish_backup, which will package and e-mail a report to me.

to:

The setup depends on three bash shell scripts, one on the source side and two on the remote side. Backup is started by executing run_remote_jobs on the source side. run_remote_jobs will then, via ssh, call the script prepare_backup on the remote side. prepare_backup will prepare backup dirs to receive a new increment (e.g. shift daily.0 to daily.1). After that, run_remote_jobs will perform the actual backup jobs (listed in the file jobs.txt). Finally, run_remote_jobs will call the remote script finish_backup, which will package and e-mail a report to me.

Changed line 364 from:

This is file rsync.bat:

to:

This is file rsync.bat.

Changed line 378 from:

Example e-mail report:

to:

Example e-mail report.

March 21, 2008, at 06:32 PM by bjohv052 -- Slight upgrade
Changed lines 16-19 from:

The source machine is a desktop Windows box in my home running Windows XP Professional. At any given time, it may be on, off or standby (S3).

The remote machine is the nslu2 running Debian. It is placed off-site in my employers server room and is on 24/7.

to:

The source machine is a desktop Windows box in my home running Windows XP Professional. At any given time, it may be on, off or standby (S3). The remote machine is the nslu2 running Debian. It is placed off-site in my employers server room and is on 24/7.

The setup depends on three bash shell scripts and one text file, one on the source side and two on the remote side. Backup is started by executing run_remote_jobs on the source side. run_remote_jobs will then, via ssh, call the script prepare_backup on the remote side. prepare_backup will prepare backup dirs to receive a new increment (e.g. shift daily.0 to daily.1). After that, run_remote_jobs will perform the actual backup jobs (listed in the file jobs.txt). Finally, run_remote_jobs will call the remote script finish_backup, which will package and e-mail a report to me.

Changed lines 360-361 from:

To completely automate things, we will take advantage of the fact that the Windows Task Scheduler has the ability to wake the machine from S3 standby or hibernate, and that BIOS settings allow me to wake the machine from the off state. BIOS settings differ from machine to machine, but most machines have this possibility. If you don't have it, simply never turn your machine off and use standby or hibernate instead. My machine is usually in standby after I have used it, and off after my wife has used it. That's why I use both strategies.

to:

To completely automate things, we will take advantage of the fact that the Windows Task Scheduler has the ability to wake the machine from S3 standby or hibernate, and that BIOS settings allows us to wake the machine from the off state. BIOS settings differ from machine to machine, but most machines have this possibility. If you don't have it, simply never turn your machine off and use standby or hibernate instead. My machine is usually in standby after I have used it, and off after my wife has used it. That's why I use both strategies.

March 21, 2008, at 06:21 PM by bjohv052 -- Correction of typos
Changed lines 21-22 from:

Since rsync is primarily a *nix tool, you need to get a Windows port. Of course, you could try a minimalist approach like cwRsync (http://www.itefix.no/cwrsync/) or DeltaCopy? (http://www.aboutmyip.com/AboutMyXApp/DeltaCopy.jsp), but I advise you not to. The reason is that none of them gives you the tremendous benefit of bash scripting. Instead, install Cygwin (http://www.cygwin.com/) on your machine. It's tried, tested, maintained and works. At least as far as I can tell.

to:

Since rsync is primarily a *nix tool, you need to get a Windows port. Of course, you could try a minimalistic approach like cwRsync (http://www.itefix.no/cwrsync/) or DeltaCopy? (http://www.aboutmyip.com/AboutMyXApp/DeltaCopy.jsp), but I advise you not to. The reason is that none of them gives you the tremendous benefit of bash scripting. Instead, install Cygwin (http://www.cygwin.com/) on your machine. It's tried, tested, maintained and works. At least as far as I can tell. Oh, and install the rsync and shutdown packages while you're at it.

Changed line 150 from:
  1. Re-suspend machine
to:
  1. Re-suspend machine (requires Cygwin "shutdown" package)
Deleted lines 366-367:

REM ######### RSYNC JOBS START HERE ########

Deleted line 368:

bash /home/Bj”rn/rsync/run_local_jobs.sh

Deleted line 369:
March 21, 2008, at 12:58 PM by bjohv052 -- Minor corrections
Changed lines 2-3 from:

Since a couple of weeks I have an automated setup that does incremental backups of all important data on my windows box and sends it all to my nslu2 on a remote location.

to:

Since a couple of weeks I have an automated setup that does incremental backups of all important data on my windows box and sends it to my nslu2 on a remote location.

Added lines 9-14:

This how-to will give you the following:

  1. Automated backup performed daily with no user interaction.
  2. Incremental backups, meaning additional backups will take virtually no space at all if no changes have been made on the source machine.
  3. Configurable number of backup increments.
  4. A neatly packaged report e-mailed to you after every backup.
Changed lines 18-26 from:

The remote machine, is the nslu2 running Debian. It is placed off-site in my employers server room and is on 24/7.

The Details

First, let's figure out what we want. This how-to will give you the following:

  1. Automated backup performed daily with no user interaction.
  2. Incremental backups, meaning additional backups will take virtually no space at all if no changes have been made on the source machine.
  3. Configurable number of backup increments.
  4. A neatly packaged report e-mailed to you after every backup.
to:

The remote machine is the nslu2 running Debian. It is placed off-site in my employers server room and is on 24/7.

Changed lines 27-28 from:

Read the man pages at http://rsync.samba.org/. Yes, all of it!

to:

Read the man pages at http://rsync.samba.org/. Yes, all of it! If you don't have rsync, just run aptitude install rsync as root.

Changed lines 157-158 from:

The files jobs.txt, used by run_remote_jobs.sh, lists all rsync jobs to be run. It looks like this.

to:

The files jobs.txt, used by run_remote_jobs.sh, lists all rsync jobs to be run. The first argument of each line is data on the Windows machine. The second argument is the location for the data on the nslu2.

Changed lines 162-167 from:

"/cygdrive/e" dokument "/cygdrive/c/Docume~1/Anna/Favori~1" favoriter.anna "/cygdrive/c/Docume~1/Bjrn~1/Favori~1" favoriter.bjorn "/cygdrive/f" lagring "/cygdrive/c/Docume~1/Anna/Skrivb~1" skrivbord.anna "/cygdrive/c/Docume~1/Bjrn~1/Skrivb~1" skrivbord.bjorn

to:

"/cygdrive/e" dokument "/cygdrive/c/Docume~1/Anna/Favori~1" favoriter.anna "/cygdrive/c/Docume~1/Bjrn~1/Favori~1" favoriter.bjorn "/cygdrive/f" lagring "/cygdrive/c/Docume~1/Anna/Skrivb~1" skrivbord.anna "/cygdrive/c/Docume~1/Bjrn~1/Skrivb~1" skrivbord.bjorn

March 21, 2008, at 12:46 PM by bjohv052 -- Version 1.0 released
Changed lines 2-3 from:

Since a couple of weeks I have an automated setup that does incremental backups of all important data on my windows box and sends it all to my nslu2 on a remote location. This how-to is not finished, please check back regularly.

to:

Since a couple of weeks I have an automated setup that does incremental backups of all important data on my windows box and sends it all to my nslu2 on a remote location.

Changed lines 119-122 from:
    RSYNC_COMMAND="/usr/bin/rsync -a --no-p --chmod=ugo=rwX --stats -e \"$SSH_COMMAND\" --delete --modify-window=1 --link-dest=/home/bjorn/backup/$TMP_DEST_SHORT/daily.1 --rsync-path=\"$RSYNC_PATH\""
to:
    RSYNC_COMMAND="/usr/bin/rsync -a --no-p --chmod=ugo=rwX --stats                   -e \"$SSH_COMMAND\" --delete --modify-window=1 \ 
                  --link-dest=/home/bjorn/backup/$TMP_DEST_SHORT/daily.1                   --rsync-path=\"$RSYNC_PATH\""
Changed lines 124-125 from:
    echo "############### Starting remote job $i of $(($SRC_COUNTER - 1)) ($TMP_DEST_SHORT) ###############"
to:
    echo "############### Starting remote job $i of $(($SRC_COUNTER - 1))           ($TMP_DEST_SHORT) ###############"
Added lines 151-153:
  1. Re-suspend machine

shutdown -p now

Changed lines 368-374 from:

text here later

to:

REM ######### RSYNC JOBS START HERE ########

c: chdir C:\cygwin\bin bash /home/Bj”rn/rsync/run_local_jobs.sh bash /home/Bj”rn/rsync/run_remote_jobs.sh

March 21, 2008, at 12:40 PM by bjohv052 -- Added more info
Changed lines 64-84 from:

text here later @]

The files jobs.txt, used by run_remote_jobs.sh, lists all rsync jobs to be run. It looks like this.

This is file jobs.txt.

text here later

Remote Side Scripts

On the nslu2 side you may end up with something like this.

This is script prepare_backup.sh, called from the source machine via ssh.

[@

  1. !/bin/bash
to:
  1. !bin/bash
Changed lines 67-82 from:

RM=/bin/rm MV=/bin/mv LS=/bin/ls GREP=/bin/grep TAIL=/usr/bin/tail MKDIR=/bin/mkdir RSYNC=/usr/bin/rsync

NR_OF_DAILY=7 NR_OF_WEEKLY=4 NR_OF_MONTHLY=3 NR_OF_QUARTERLY=4

DAY=`date +%d` MONTH=`date +%m` DOW=`date +%u`

to:

TIME="/usr/bin/date +%T" RM=/usr/bin/rm

JOBS=`cat /home/Björn/rsync/jobs.txt`

Changed lines 72-82 from:

LOGFILE_TMP=/tmp/"$DAYDATE"_tmp.log

  1. Which to shift?

if $DOW -eq 1 ? ; then

    SHIFT_WEEK=true
    if $DAY -le 7 ? ; then
        SHIFT_MONTH=true
        if $MONTH -eq 1 ? || $MONTH -eq 4 ? ||            $MONTH -eq 7 ? || $MONTH -eq 10 ? ; then
            SHIFT_QUARTER=true
        fi
to:

LOGFILE=/home/bjorn/backup/logs/"$DAYDATE"_log.log LOGFILE_STD=/home/Björn/rsync/"$DAYDATE"_std.log LOGFILE_ERR=/home/Björn/rsync/"$DAYDATE"_err.log RSYNC_PATH="/usr/bin/rsync --log-file=$LOGFILE --log-file-format=%o\ %i\ %n" SSH_COMMAND="/usr/bin/ssh -i /path/to/key" SCP_COMMAND="/usr/bin/scp -i /path/to/key" LOCATION=remote.example.org BACKUP_DEST=$LOCATION:/home/bjorn/backup

  1. Counters for the loop below

COUNTER=1 SRC_COUNTER=1 DEST_COUNTER=1

  1. Assign every source and destination its own variable SOURCE_no and DEST_no,
  2. as well as a variable DEST_ALL containing all sources

for i in $JOBS ; do

    if [ `expr $COUNTER % 2` -eq 1 ] ; then     # Do modulus check to identify even/odd args.
        eval "SOURCE_$SRC_COUNTER=$i"
        let SRC_COUNTER=SRC_COUNTER+1
        else
        eval "DEST_$DEST_COUNTER=$i"
        DEST_ALL="$DEST_ALL $i"
        let DEST_COUNTER=DEST_COUNTER+1
Changed lines 97-98 from:

fi

to:
    let COUNTER=COUNTER+1

done

Changed lines 101-127 from:
  1. Perform first monday of every quarter

if $SHIFT_QUARTER = true ? ; then

    echo "First monday of quarter. Shifting quarterly." >> $LOGFILE_TMP
  1. Do for each backup job
    for job in $@ ; do
        SNAPSHOT=/home/bjorn/backup/$job
  1. Find latest monthly snapshot
        LATEST_MONTHLY=`$LS $SNAPSHOT | $GREP monthly | $TAIL -1`
  1. Shift snapshots
  2. Step 1: delete the oldest snapshot, if it exists
        if [ -d $SNAPSHOT/quarterly.$(($NR_OF_QUARTERLY - 1)) ] ; then
            $RM -rf $SNAPSHOT/quarterly.$(($NR_OF_QUARTERLY - 1))
        fi
  1. Step 2: shift the other snapshots(s) by one, if they exist
        for ((quarter = $(($NR_OF_QUARTERLY - 2)) ; quarter >= 0 ; quarter -= 1)) ; do
            if [ -d $SNAPSHOT/quarterly.$quarter ] ; then
                $MV $SNAPSHOT/quarterly.$quarter $SNAPSHOT/quarterly.$(($quarter + 1))
            fi
        done
  1. Step 3: move the latest monthly snapshot up to quarterly
    $MV $LATEST_MONTHLY $SNAPSHOT/quarterly.0
    done
to:
  1. Redirect std_in and std_out

exec 4>&1 exec 6>&2

exec 1>>$LOGFILE_STD exec 2>>$LOGFILE_ERR

  1. Allow network to recover after S3 standby

sleep 30

  1. Prepare dirs on nslu2 for incremental backup

$SSH_COMMAND $LOCATION /home/bjorn/backup/scripts/prepare_backup.sh $DEST_ALL

  1. Perform backup jobs

for ((i = 1 ; i <= $(($SRC_COUNTER - 1)) ; i += 1)) ; do

    eval "TMP_SOURCE=$"SOURCE_$i""
    eval "TMP_DEST_SHORT=$"DEST_$i""
    eval "TMP_DEST=$BACKUP_DEST/$TMP_DEST_SHORT/daily.0"
    RSYNC_COMMAND="/usr/bin/rsync -a --no-p --chmod=ugo=rwX --stats -e \"$SSH_COMMAND\" --delete --modify-window=1 --link-dest=/home/bjorn/backup/$TMP_DEST_SHORT/daily.1 --rsync-path=\"$RSYNC_PATH\""
    echo
    echo "############### Starting remote job $i of $(($SRC_COUNTER - 1)) ($TMP_DEST_SHORT) ###############"
    eval "$RSYNC_COMMAND \"$TMP_SOURCE\" \"$TMP_DEST\""

done

echo echo "Backup jobs finished at `$TIME`."

  1. Restore std_in and std_out

exec 1>&4 4>&- exec 2>&6 6>&-

  1. Transfer log file(s)

$SCP_COMMAND $LOGFILE_STD bjorn@$LOCATION:/home/bjorn/backup/logs/"$DAYDATE"_std.log

  1. Transfer std_err file only if size > 0

if [ -s $LOGFILE_ERR ] ; then

    $SCP_COMMAND $LOGFILE_ERR bjorn@$LOCATION:/home/bjorn/backup/logs/"$DAYDATE"_err.log
Changed lines 140-200 from:
  1. Now, do the same for months on first monday of every month

if $SHIFT_MONTH = true ? ; then

    echo "First monday of month. Shifting monthly." >> $LOGFILE_TMP

    for job in $@ ; do
        SNAPSHOT=/home/bjorn/backup/$job
        LATEST_WEEKLY=`$LS $SNAPSHOT | $GREP weekly | $TAIL -1`

        if [ -d $SNAPSHOT/monthly.$(($NR_OF_MONTHLY - 1)) ] ; then
            $RM -rf $SNAPSHOT/monthly.$(($NR_OF_MONTHLY - 1))
        fi

        for ((month = $(($NR_OF_MONTHLY - 2)) ; month >= 0 ; month -= 1)) ; do
            if [ -d $SNAPSHOT/monthly.$month ] ; then
                $MV $SNAPSHOT/monthly.$month $SNAPSHOT/monthly.$(($month + 1))
            fi
        done

    $MV $LATEST_WEEKLY $SNAPSHOT/monthly.0
    done

fi

  1. And for weeks on every monday

if $SHIFT_WEEK = true ? ; then

    echo "Monday. Shifting weekly." >> $LOGFILE_TMP

    for job in $@ ; do
        SNAPSHOT=/home/bjorn/backup/$job
        LATEST_DAILY=`$LS $SNAPSHOT | $GREP daily | $TAIL -1`

        if [ -d $SNAPSHOT/weekly.$(($NR_OF_WEEKLY - 1)) ] ; then
            $RM -rf $SNAPSHOT/weekly.$(($NR_OF_WEEKLY - 1))
        fi

        for ((week = $(($NR_OF_WEEKLY - 2)) ; week >= 0 ; week -= 1)) ; do
            if [ -d $SNAPSHOT/weekly.$week ] ; then
                $MV $SNAPSHOT/weekly.$week $SNAPSHOT/weekly.$(($week + 1))
            fi
        done

    $MV $LATEST_DAILY $SNAPSHOT/weekly.0
    done

fi

  1. Days shall always be shifted

for job in $@ ; do

    SNAPSHOT=/home/bjorn/backup/$job

    if [ -d $SNAPSHOT/daily.$(($NR_OF_DAILY - 1)) ] ; then
        $RM -rf $SNAPSHOT/daily.$(($NR_OF_DAILY - 1))
    fi

    for ((day = $(($NR_OF_DAILY - 2)) ; day >= 0 ; day -= 1)) ; do
        if [ -d $SNAPSHOT/daily.$day ] ; then
            $MV $SNAPSHOT/daily.$day $SNAPSHOT/daily.$(($day + 1))
        fi
    done

    $MKDIR $SNAPSHOT/daily.0

done

to:
  1. Delete log file(s)

$RM $LOGFILE_STD $RM $LOGFILE_ERR

  1. Order nslu2 to create and send e-mail report

$SSH_COMMAND $LOCATION /home/bjorn/backup/scripts/finish_backup.sh

Changed lines 151-153 from:

This is script finish_backup.sh, called from the source machine via ssh.

to:

The files jobs.txt, used by run_remote_jobs.sh, lists all rsync jobs to be run. It looks like this.

This is file jobs.txt.

Added lines 156-170:

"/cygdrive/e" dokument "/cygdrive/c/Docume~1/Anna/Favori~1" favoriter.anna "/cygdrive/c/Docume~1/Bjrn~1/Favori~1" favoriter.bjorn "/cygdrive/f" lagring "/cygdrive/c/Docume~1/Anna/Skrivb~1" skrivbord.anna "/cygdrive/c/Docume~1/Bjrn~1/Skrivb~1" skrivbord.bjorn @]

Remote Side Scripts

On the nslu2 side you may end up with something like this.

This is script prepare_backup.sh, called from the source machine via ssh.

[@

Deleted lines 173-175:

HEAD=/usr/bin/head TAIL=/usr/bin/tail CAT=/bin/cat

Changed lines 175-189 from:
to:

MV=/bin/mv LS=/bin/ls GREP=/bin/grep TAIL=/usr/bin/tail MKDIR=/bin/mkdir RSYNC=/usr/bin/rsync

NR_OF_DAILY=7 NR_OF_WEEKLY=4 NR_OF_MONTHLY=3 NR_OF_QUARTERLY=4

DAY=`date +%d` MONTH=`date +%m` DOW=`date +%u`

Deleted lines 190-192:

LOGFILE_STD=/home/bjorn/backup/logs/"$DAYDATE"_std.log LOGFILE_ERR=/home/bjorn/backup/logs/"$DAYDATE"_err.log LOGFILE_LOG=/home/bjorn/backup/logs/"$DAYDATE"_log.log

Added lines 193-204:
  1. Which to shift?

if $DOW -eq 1 ? ; then

    SHIFT_WEEK=true
    if $DAY -le 7 ? ; then
        SHIFT_MONTH=true
        if $MONTH -eq 1 ? || $MONTH -eq 4 ? ||            $MONTH -eq 7 ? || $MONTH -eq 10 ? ; then
            SHIFT_QUARTER=true
        fi
    fi

fi

Changed lines 206-221 from:
  1. Append info to log file

echo >> $LOGFILE_STD echo "Printout from df -h:" >> $LOGFILE_STD df -h >> $LOGFILE_STD

  1. Create tmp file to send

$HEAD -1 $LOGFILE_STD >> $LOGFILE_TMP $TAIL -9 $LOGFILE_STD >> $LOGFILE_TMP echo >> $LOGFILE_TMP

  1. Check if errors were reported

if [ -e $LOGFILE_ERR ] ; then

    echo "The following errors were reported:" >> $LOGFILE_TMP
    $CAT $LOGFILE_ERR >> $LOGFILE_TMP

else

    echo "No errors were reported." >> $LOGFILE_TMP
to:
  1. Perform first monday of every quarter

if $SHIFT_QUARTER = true ? ; then

    echo "First monday of quarter. Shifting quarterly." >> $LOGFILE_TMP
  1. Do for each backup job
    for job in $@ ; do
        SNAPSHOT=/home/bjorn/backup/$job
  1. Find latest monthly snapshot
        LATEST_MONTHLY=`$LS $SNAPSHOT | $GREP monthly | $TAIL -1`
  1. Shift snapshots
  2. Step 1: delete the oldest snapshot, if it exists
        if [ -d $SNAPSHOT/quarterly.$(($NR_OF_QUARTERLY - 1)) ] ; then
            $RM -rf $SNAPSHOT/quarterly.$(($NR_OF_QUARTERLY - 1))
        fi
  1. Step 2: shift the other snapshots(s) by one, if they exist
        for ((quarter = $(($NR_OF_QUARTERLY - 2)) ; quarter >= 0 ; quarter -= 1)) ; do
            if [ -d $SNAPSHOT/quarterly.$quarter ] ; then
                $MV $SNAPSHOT/quarterly.$quarter $SNAPSHOT/quarterly.$(($quarter + 1))
            fi
        done
  1. Step 3: move the latest monthly snapshot up to quarterly
    $MV $LATEST_MONTHLY $SNAPSHOT/quarterly.0
    done
Changed lines 235-247 from:

echo >> $LOGFILE_TMP

  1. Check for updated files and append to tmp file

echo "The following files were added, updated or deleted:" >> $LOGFILE_TMP egrep [\<\>ch\.\*][fLDS][c\.\+\ \?][s\.\+\ \?][t\.\+\ \?][p\.\+\ \?] [o\.\+\ \?][g\.\+\ \?][u\.\+\ \?][a\.\+\ \?][x\.\+\ \?] $LOGFILE_LOG >> $LOGFILE_TMP

  1. E-mail file to me

mail -s "Backup of plysch $DAYDATE" my.email.address@gmail.com < $LOGFILE_TMP

  1. Remove tmp file

$RM $LOGFILE_TMP

to:
  1. Now, do the same for months on first monday of every month

if $SHIFT_MONTH = true ? ; then

    echo "First monday of month. Shifting monthly." >> $LOGFILE_TMP

    for job in $@ ; do
        SNAPSHOT=/home/bjorn/backup/$job
        LATEST_WEEKLY=`$LS $SNAPSHOT | $GREP weekly | $TAIL -1`

        if [ -d $SNAPSHOT/monthly.$(($NR_OF_MONTHLY - 1)) ] ; then
            $RM -rf $SNAPSHOT/monthly.$(($NR_OF_MONTHLY - 1))
        fi

        for ((month = $(($NR_OF_MONTHLY - 2)) ; month >= 0 ; month -= 1)) ; do
            if [ -d $SNAPSHOT/monthly.$month ] ; then
                $MV $SNAPSHOT/monthly.$month $SNAPSHOT/monthly.$(($month + 1))
            fi
        done

    $MV $LATEST_WEEKLY $SNAPSHOT/monthly.0
    done

fi

  1. And for weeks on every monday

if $SHIFT_WEEK = true ? ; then

    echo "Monday. Shifting weekly." >> $LOGFILE_TMP

    for job in $@ ; do
        SNAPSHOT=/home/bjorn/backup/$job
        LATEST_DAILY=`$LS $SNAPSHOT | $GREP daily | $TAIL -1`

        if [ -d $SNAPSHOT/weekly.$(($NR_OF_WEEKLY - 1)) ] ; then
            $RM -rf $SNAPSHOT/weekly.$(($NR_OF_WEEKLY - 1))
        fi

        for ((week = $(($NR_OF_WEEKLY - 2)) ; week >= 0 ; week -= 1)) ; do
            if [ -d $SNAPSHOT/weekly.$week ] ; then
                $MV $SNAPSHOT/weekly.$week $SNAPSHOT/weekly.$(($week + 1))
            fi
        done

    $MV $LATEST_DAILY $SNAPSHOT/weekly.0
    done

fi

  1. Days shall always be shifted

for job in $@ ; do

    SNAPSHOT=/home/bjorn/backup/$job

    if [ -d $SNAPSHOT/daily.$(($NR_OF_DAILY - 1)) ] ; then
        $RM -rf $SNAPSHOT/daily.$(($NR_OF_DAILY - 1))
    fi

    for ((day = $(($NR_OF_DAILY - 2)) ; day >= 0 ; day -= 1)) ; do
        if [ -d $SNAPSHOT/daily.$day ] ; then
            $MV $SNAPSHOT/daily.$day $SNAPSHOT/daily.$(($day + 1))
        fi
    done

    $MKDIR $SNAPSHOT/daily.0

done

Changed lines 300-305 from:

Step 5: Further Automation

To completely automate things, we will take advantage of the fact that the Windows Task Scheduler has the ability to wake the machine from S3 standby or hibernate, and that BIOS settings allow me to wake the machine from the off state. BIOS settings differ from machine to machine, but most machines have this possibility. If you don't have it, simply never turn your machine off and use standby or hibernate instead. My machine is usually in standby after I have used it, and off after my wife has used it. That's why I use both strategies.

In the task scheduler, schedule the machine to run the file rsync.bat every morning at 02:30. Be sure to tick the checkbox "Wake the computer to run this task".

This is file rsync.bat:

to:

This is script finish_backup.sh, called from the source machine via ssh.

Changed lines 303-349 from:

text here later

to:
  1. !/bin/bash
  2. ------------- Variables ----------------------------------------------

HEAD=/usr/bin/head TAIL=/usr/bin/tail CAT=/bin/cat RM=/bin/rm

DAYDATE=`date +m%d` LOGFILE_STD=/home/bjorn/backup/logs/"$DAYDATE"_std.log LOGFILE_ERR=/home/bjorn/backup/logs/"$DAYDATE"_err.log LOGFILE_LOG=/home/bjorn/backup/logs/"$DAYDATE"_log.log LOGFILE_TMP=/tmp/"$DAYDATE"_tmp.log

  1. ------------- The script itself --------------------------------------
  2. Append info to log file

echo >> $LOGFILE_STD echo "Printout from df -h:" >> $LOGFILE_STD df -h >> $LOGFILE_STD

  1. Create tmp file to send

$HEAD -1 $LOGFILE_STD >> $LOGFILE_TMP $TAIL -9 $LOGFILE_STD >> $LOGFILE_TMP echo >> $LOGFILE_TMP

  1. Check if errors were reported

if [ -e $LOGFILE_ERR ] ; then

    echo "The following errors were reported:" >> $LOGFILE_TMP
    $CAT $LOGFILE_ERR >> $LOGFILE_TMP

else

    echo "No errors were reported." >> $LOGFILE_TMP

fi

echo >> $LOGFILE_TMP

  1. Check for updated files and append to tmp file

echo "The following files were added, updated or deleted:" >> $LOGFILE_TMP egrep [\<\>ch\.\*][fLDS][c\.\+\ \?][s\.\+\ \?][t\.\+\ \?][p\.\+\ \?] [o\.\+\ \?][g\.\+\ \?][u\.\+\ \?][a\.\+\ \?][x\.\+\ \?] $LOGFILE_LOG >> $LOGFILE_TMP

  1. E-mail file to me

mail -s "Backup of plysch $DAYDATE" my.email.address@gmail.com < $LOGFILE_TMP

  1. Remove tmp file

$RM $LOGFILE_TMP

exit 0

Added lines 353-364:

Step 5: Further Automation

To completely automate things, we will take advantage of the fact that the Windows Task Scheduler has the ability to wake the machine from S3 standby or hibernate, and that BIOS settings allow me to wake the machine from the off state. BIOS settings differ from machine to machine, but most machines have this possibility. If you don't have it, simply never turn your machine off and use standby or hibernate instead. My machine is usually in standby after I have used it, and off after my wife has used it. That's why I use both strategies.

In the task scheduler, schedule the machine to run the file rsync.bat every morning at 02:30. Be sure to tick the checkbox "Wake the computer to run this task".

This is file rsync.bat:

text here later
March 20, 2008, at 02:07 PM by bjohv052 -- Added more info
Changed lines 12-13 from:

The remote machine, receiver of the backup, is the nslu2 placed off-site in my employers server room running Debian. It is on 24/7.

to:

The remote machine, is the nslu2 running Debian. It is placed off-site in my employers server room and is on 24/7.

Changed line 16 from:
  1. Automated backup performed at any interval with no user interaction.
to:
  1. Automated backup performed daily with no user interaction.
Changed line 18 from:
  1. Configurable backup scheme (per hour, day, week and so on).
to:
  1. Configurable number of backup increments.
Changed line 30 from:

Step 4: Scripting it

to:

Step 4: Scripting It

Changed lines 35-36 from:
  • on the source side, pulling the backup to the source, or
  • on the remote side, pushing the backup to the source.
to:
  • on the source side, pulling the backup to the remote, or
  • on the remote side, pushing the backup to the remote.
Changed lines 40-44 from:

We will use the latter setup in a push fashion. The reasons are that

  • ssh encrypts the transfer
  • the remote shell (ssh) requires an ssh server, which is alreade available on the remote machine. Pull would require

installing OpenSSH? on the source machine.

to:

We will use the latter setup in a push fashion.

Changed lines 56-58 from:

That is a total of 18 increments and a whole year to regret mistakes. I've found that an extra increment uses only roughly 30 Mb for 80.000+ files if there are no changes (this is due to hard-linking the unchanged files). Since 30 Mb isn't much these days, one can easily afford more than 18 increments.

Source side scripts

to:

That is a total of 18 increments and a whole year to regret mistakes. I've found that an extra increment uses only roughly 30 Mb for 80.000+ files if there are no changes (this is due to hard-linking the unchanged files). Since 30 Mb isn't much these days, one can easily afford more than 18 increments. Just tweak the scripts to suit your needs.

Source Side Scripts

Changed line 77 from:

Remote side scripts

to:

Remote Side Scripts

Changed line 265 from:

Step 5: Further automation

to:

Step 5: Further Automation

Changed lines 268-270 from:

In the task scheduler, schedule the machine to run the file rsync.bat every morning at 02:30. Be sure to tick the checkbox "Wake the computer to run this task". rsync.bat looks like this:

to:

In the task scheduler, schedule the machine to run the file rsync.bat every morning at 02:30. Be sure to tick the checkbox "Wake the computer to run this task".

This is file rsync.bat:

Changed line 279 from:

Example e-mail report

to:

Example E-mail Report

Added line 282:

Example e-mail report:

March 20, 2008, at 01:40 PM by bjohv052 -- Added more info
Changed lines 64-67 from:

Remote side scripts

On the nslu2 side you may end up with something like this.

This is script prepare_backup.sh, called from the source machine via ssh.

to:

This is script run_remote_jobs.sh, performing all rsync jobs on the source machine.

Added lines 67-85:

text here later @]

The files jobs.txt, used by run_remote_jobs.sh, lists all rsync jobs to be run. It looks like this.

This is file jobs.txt.

text here later

Remote side scripts

On the nslu2 side you may end up with something like this.

This is script prepare_backup.sh, called from the source machine via ssh.

[@

March 20, 2008, at 01:27 PM by bjohv052 -- Added more info
Changed lines 253-255 from:
to:

To completely automate things, we will take advantage of the fact that the Windows Task Scheduler has the ability to wake the machine from S3 standby or hibernate, and that BIOS settings allow me to wake the machine from the off state. BIOS settings differ from machine to machine, but most machines have this possibility. If you don't have it, simply never turn your machine off and use standby or hibernate instead. My machine is usually in standby after I have used it, and off after my wife has used it. That's why I use both strategies.

In the task scheduler, schedule the machine to run the file rsync.bat every morning at 02:30. Be sure to tick the checkbox "Wake the computer to run this task". rsync.bat looks like this:

Changed line 258 from:
to:

text here later

Added lines 262-263:

Then, in the BIOS, set your machine to boot every morning at 02:25. That way it will have plenty of time to boot before the task executes at 02:30. On my machine the BIOS will wake the machine only if it is off, not if it is in standby or hibernate. By using both the task scheduler and the BIOS setting, we can be sure that the machine wakes up, regardless of which state it is in.

March 20, 2008, at 01:14 PM by bjohv052 -- Added more info
Added lines 261-262:

Each morning I receive an e-mail report looking like this. It gives me confirmation that everything works OK, and I can also see if my backup disk is getting full.

Changed lines 285-343 from:

2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Cygwin/home/Björn/.Xdefaults~ 2008/03/20 02:33:31 [12307] >f.st......f/Programvara - freeware/Cygwin/home/Björn/.bash_history 2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Cygwin/home/Björn/rsync/20080320_err.log 2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Cygwin/home/Björn/rsync/20080320_std.log 2008/03/20 02:33:31 [12307] >f.st......f/Programvara - freeware/Cygwin/home/Björn/rsync/run_remote_jobs.sh 2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Cygwin/home/Björn/rsync/run_remote_jobs.sh~ 2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/Cygwin/http%3a%2f%2fftp-stud.fht-esslingen.de%2fpub%2fMirrors%2fsources.redhat.com%2fcygwin/setup.ini 2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Cygwin/http%3a%2f%2fftp-stud.fht-esslingen.de%2fpub%2fMirrors%2fsources.redhat.com%2fcygwin/release/_update-info-dir/_update-info-dir-00598-1.tar.bz2 2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Cygwin/http%3a%2f%2fftp-stud.fht-esslingen.de%2fpub%2fMirrors%2fsources.redhat.com%2fcygwin/release/bzip2/bzip2-1.0.5-1.tar.bz2 2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Cygwin/http%3a%2f%2fftp-stud.fht-esslingen.de%2fpub%2fMirrors%2fsources.redhat.com%2fcygwin/release/bzip2/libbz2_1/libbz2_1-1.0.5-1.tar.bz2 2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Cygwin/http%3a%2f%2fftp-stud.fht-esslingen.de%2fpub%2fMirrors%2fsources.redhat.com%2fcygwin/release/rxvt/rxvt-20050409-7.tar.bz2 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/pluginreg.dat 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/blocklist.xml 2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/bookmarks.bak 2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/bookmarks.html 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/browserstate-offline.xml 2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/browserstate-temp.xml 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/cert8.db 2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/cookies.txt 2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/history.dat 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/key3.db 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/kf.txt 2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/localstore.rdf 2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/metrics.xml 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/prefs.js 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/urlclassifier2.sqlite 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/GoogleToolbarData?/features.properties 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/GoogleToolbarData?/kf.txt 2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/GoogleToolbarData?/searchhistory.xml 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/GoogleToolbarData?/textreuse.dat 2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/GoogleToolbarData?/feeds/toolbar.google.com_AE7E099EE2F2A2A8D692.xml 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/GoogleToolbarData?/feeds/toolbar.google.com_F2C8EF160C1133DD0984.xml 2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/bookmarkbackups/bookmarks-2008-03-19.html 2008/03/20 02:33:31 [12307] >f.st......f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/browserstate-logs/log-20080317-182249-265.txt 2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/browserstate-logs/log-20080319-193143-125.txt 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Motherboard monitor/Data/MBM 5.INI 2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/foobar2000/Application Data/PlaybackStatistics?.dat 2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/foobar2000/Application Data/foobar2000.cfg 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/lyrics.xml 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/theme.fth 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000001.fpl 2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000002.fpl 2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000003.fpl 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000004.fpl 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000005.fpl 2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000006.fpl 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000007.fpl 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000008.fpl 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000009.fpl 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000010.fpl 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000011.fpl 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000012.fpl 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000013.fpl 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000014.fpl 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000015.fpl 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000016.fpl 2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000017.fpl 2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000018.fpl 2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/foobar2000/Application Data/playlists/index.dat

to:

2008/03/20 02:33:31 [12307] >f.stp.....foobar2000/Application Data/PlaybackStatistics?.dat 2008/03/20 02:33:31 [12307] >f.stp.....foobar2000/Application Data/foobar2000.cfg 2008/03/20 02:33:31 [12307] >f..tp.....foobar2000/Application Data/lyrics.xml 2008/03/20 02:33:31 [12307] >f..tp.....foobar2000/Application Data/theme.fth 2008/03/20 02:33:31 [12307] >f..tp.....foobar2000/Application Data/playlists/00000001.fpl 2008/03/20 02:33:31 [12307] >f.stp.....foobar2000/Application Data/playlists/00000002.fpl 2008/03/20 02:33:31 [12307] >f.stp.....foobar2000/Application Data/playlists/00000003.fpl 2008/03/20 02:33:31 [12307] >f..tp.....foobar2000/Application Data/playlists/00000004.fpl 2008/03/20 02:33:31 [12307] >f..tp.....foobar2000/Application Data/playlists/00000005.fpl 2008/03/20 02:33:31 [12307] >f.stp.....foobar2000/Application Data/playlists/00000006.fpl 2008/03/20 02:33:31 [12307] >f..tp.....foobar2000/Application Data/playlists/00000007.fpl 2008/03/20 02:33:31 [12307] >f..tp.....foobar2000/Application Data/playlists/00000008.fpl 2008/03/20 02:33:31 [12307] >f..tp.....foobar2000/Application Data/playlists/00000009.fpl 2008/03/20 02:33:31 [12307] >f..tp.....foobar2000/Application Data/playlists/00000010.fpl 2008/03/20 02:33:31 [12307] >f..tp.....foobar2000/Application Data/playlists/00000011.fpl 2008/03/20 02:33:31 [12307] >f..tp.....foobar2000/Application Data/playlists/00000012.fpl 2008/03/20 02:33:31 [12307] >f..tp.....foobar2000/Application Data/playlists/00000013.fpl 2008/03/20 02:33:31 [12307] >f..tp.....foobar2000/Application Data/playlists/00000014.fpl 2008/03/20 02:33:31 [12307] >f..tp.....foobar2000/Application Data/playlists/00000015.fpl 2008/03/20 02:33:31 [12307] >f..tp.....foobar2000/Application Data/playlists/00000016.fpl 2008/03/20 02:33:31 [12307] >f..tp.....foobar2000/Application Data/playlists/00000017.fpl 2008/03/20 02:33:31 [12307] >f.stp.....foobar2000/Application Data/playlists/00000018.fpl 2008/03/20 02:33:31 [12307] >f.stp.....foobar2000/Application Data/playlists/index.dat

March 20, 2008, at 01:07 PM by bjohv052 -- Added more info
Changed line 48 from:
  1. 7 daily backups
to:
  • 7 daily backups
Changed lines 53-56 from:
  1. 4 weekly backups in the same fashion
  2. 3 monthly backups in the same fashion
  3. 4 quarterly backups in the same fashion
to:
  • 4 weekly backups in the same fashion
  • 3 monthly backups in the same fashion
  • 4 quarterly backups in the same fashion
  • Extensive logs saved on the nslu2
  • A compressed log e-mailed to me after every run
Added lines 251-344:

Step 5: Further automation


Example e-mail report

from	root@nslu2
to	my.e-mail.address@gmail.com,
date	Thu, Mar 20, 2008 at 2:33 AM
subject	Backup of plysch 20080320
mailed-by	gmail.com

Backup jobs started at 02:30:15.
Backup jobs finished at 02:34:06.

Printout from df -h:
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             110G  889M  104G   1% /
tmpfs                  15M     0   15M   0% /lib/init/rw
udev                   10M   44K   10M   1% /dev
tmpfs                  15M     0   15M   0% /dev/shm
/dev/sdb1             459G  144G  293G  33% /home/bjorn/backup

No errors were reported.

The following files were added, updated or deleted:
2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Cygwin/home/Björn/.Xdefaults~
2008/03/20 02:33:31 [12307] >f.st......f/Programvara - freeware/Cygwin/home/Björn/.bash_history
2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Cygwin/home/Björn/rsync/20080320_err.log
2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Cygwin/home/Björn/rsync/20080320_std.log
2008/03/20 02:33:31 [12307] >f.st......f/Programvara - freeware/Cygwin/home/Björn/rsync/run_remote_jobs.sh
2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Cygwin/home/Björn/rsync/run_remote_jobs.sh~
2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/Cygwin/http%3a%2f%2fftp-stud.fht-esslingen.de%2fpub%2fMirrors%2fsources.redhat.com%2fcygwin/setup.ini
2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Cygwin/http%3a%2f%2fftp-stud.fht-esslingen.de%2fpub%2fMirrors%2fsources.redhat.com%2fcygwin/release/_update-info-dir/_update-info-dir-00598-1.tar.bz2
2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Cygwin/http%3a%2f%2fftp-stud.fht-esslingen.de%2fpub%2fMirrors%2fsources.redhat.com%2fcygwin/release/bzip2/bzip2-1.0.5-1.tar.bz2
2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Cygwin/http%3a%2f%2fftp-stud.fht-esslingen.de%2fpub%2fMirrors%2fsources.redhat.com%2fcygwin/release/bzip2/libbz2_1/libbz2_1-1.0.5-1.tar.bz2
2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Cygwin/http%3a%2f%2fftp-stud.fht-esslingen.de%2fpub%2fMirrors%2fsources.redhat.com%2fcygwin/release/rxvt/rxvt-20050409-7.tar.bz2
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/pluginreg.dat
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/blocklist.xml
2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/bookmarks.bak
2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/bookmarks.html
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/browserstate-offline.xml
2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/browserstate-temp.xml
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/cert8.db
2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/cookies.txt
2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/history.dat
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/key3.db
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/kf.txt
2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/localstore.rdf
2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/metrics.xml
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/prefs.js
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/urlclassifier2.sqlite
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/GoogleToolbarData/features.properties
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/GoogleToolbarData/kf.txt
2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/GoogleToolbarData/searchhistory.xml
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/GoogleToolbarData/textreuse.dat
2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/GoogleToolbarData/feeds/toolbar.google.com_AE7E099EE2F2A2A8D692.xml
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/GoogleToolbarData/feeds/toolbar.google.com_F2C8EF160C1133DD0984.xml
2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/bookmarkbackups/bookmarks-2008-03-19.html
2008/03/20 02:33:31 [12307] >f.st......f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/browserstate-logs/log-20080317-182249-265.txt
2008/03/20 02:33:31 [12307] >f+++++++++f/Programvara - freeware/Firefox/Application Data/Firefox/Profiles/43a00jb9.default/browserstate-logs/log-20080319-193143-125.txt
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/Motherboard monitor/Data/MBM 5.INI
2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/foobar2000/Application Data/PlaybackStatistics.dat
2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/foobar2000/Application Data/foobar2000.cfg
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/lyrics.xml
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/theme.fth
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000001.fpl
2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000002.fpl
2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000003.fpl
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000004.fpl
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000005.fpl
2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000006.fpl
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000007.fpl
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000008.fpl
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000009.fpl
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000010.fpl
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000011.fpl
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000012.fpl
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000013.fpl
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000014.fpl
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000015.fpl
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000016.fpl
2008/03/20 02:33:31 [12307] >f..tp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000017.fpl
2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/foobar2000/Application Data/playlists/00000018.fpl
2008/03/20 02:33:31 [12307] >f.stp.....f/Programvara - freeware/foobar2000/Application Data/playlists/index.dat
2008/03/20 02:33:38 [12321] >f+++++++++Skrivb~1/Cygwin Bash Shell.URL
March 20, 2008, at 01:01 PM by bjohv052 -- Added more info
Changed lines 42-43 from:
  • the remote shell (ssh) requires an ssh server, which is alreade available on the remote machine. Pull would require installing OpenSSH? on the source machine.
to:
  • the remote shell (ssh) requires an ssh server, which is alreade available on the remote machine. Pull would require

installing OpenSSH? on the source machine.

Now, the scripts below are presented rather bluntly. This does not mean that I read bash scripts like others read the morning paper. With Google, the Advanced Bash Scripting Guide (http://tldp.org/LDP/abs/html/) and a few very basic ideas in programming, you can pull this off as well.

The aim of the scripts is to give this:

  1. 7 daily backups
    • daily.0
    • daily.1
    • ...
    • daily.6
  2. 4 weekly backups in the same fashion
  3. 3 monthly backups in the same fashion
  4. 4 quarterly backups in the same fashion

That is a total of 18 increments and a whole year to regret mistakes. I've found that an extra increment uses only roughly 30 Mb for 80.000+ files if there are no changes (this is due to hard-linking the unchanged files). Since 30 Mb isn't much these days, one can easily afford more than 18 increments.

Source side scripts

On the Windows side you may end up with something like this.

March 20, 2008, at 12:50 PM by bjohv052 -- Added more info
Changed lines 219-220 from:

egrep [\<\>ch\.\*][fLDS][c\.\+\ \?][s\.\+\ \?][t\.\+\ \?][p\.\+\ \?][o\.\+\ \?][g\.\+\ \?][u\.\+\ \?][a\.\+\ \?][x\.\+\ \?] $LOGFILE_LOG >> $LOGFILE_TMP

to:

egrep [\<\>ch\.\*][fLDS][c\.\+\ \?][s\.\+\ \?][t\.\+\ \?][p\.\+\ \?] [o\.\+\ \?][g\.\+\ \?][u\.\+\ \?][a\.\+\ \?][x\.\+\ \?] $LOGFILE_LOG >> $LOGFILE_TMP

March 20, 2008, at 12:49 PM by bjohv052 -- Added more info
Changed line 47 from:

This is script prepare_backup.sh, called from the source machine via ssh.

to:

This is script prepare_backup.sh, called from the source machine via ssh.

Deleted lines 84-86:
  1. First, backup backup scripts in case WD MyBook? fails

$RSYNC -a --delete /home/bjorn/backup/scripts /home/bjorn/backup_scripts

Changed line 179 from:

This is script prepare_backup.sh, called from the source machine via ssh.

to:

This is script finish_backup.sh, called from the source machine via ssh.

Changed lines 222-223 from:

mail -s "Backup of plysch $DAYDATE" bjohv052@gmail.com < $LOGFILE_TMP

to:

mail -s "Backup of plysch $DAYDATE" my.email.address@gmail.com < $LOGFILE_TMP

March 20, 2008, at 12:44 PM by bjohv052 -- Added more info
Added line 47:

This is script prepare_backup.sh, called from the source machine via ssh.

Added line 49:

[@

Changed line 179 from:
to:

@]

Added lines 181-232:

This is script prepare_backup.sh, called from the source machine via ssh.

#!/bin/bash

# ------------- Variables ----------------------------------------------
HEAD=/usr/bin/head
TAIL=/usr/bin/tail
CAT=/bin/cat
RM=/bin/rm

DAYDATE=`date +%Y%m%d`
LOGFILE_STD=/home/bjorn/backup/logs/"$DAYDATE"_std.log
LOGFILE_ERR=/home/bjorn/backup/logs/"$DAYDATE"_err.log
LOGFILE_LOG=/home/bjorn/backup/logs/"$DAYDATE"_log.log
LOGFILE_TMP=/tmp/"$DAYDATE"_tmp.log

# ------------- The script itself --------------------------------------
# Append info to log file
echo >> $LOGFILE_STD
echo "Printout from df -h:" >> $LOGFILE_STD
df -h >> $LOGFILE_STD

# Create tmp file to send
$HEAD -1 $LOGFILE_STD >> $LOGFILE_TMP
$TAIL -9 $LOGFILE_STD >> $LOGFILE_TMP
echo >> $LOGFILE_TMP

# Check if errors were reported
if [ -e $LOGFILE_ERR ] ; then
    echo "The following errors were reported:" >> $LOGFILE_TMP
    $CAT $LOGFILE_ERR >> $LOGFILE_TMP
else
    echo "No errors were reported." >> $LOGFILE_TMP
fi

echo >> $LOGFILE_TMP

# Check for updated files and append to tmp file
echo "The following files were added, updated or deleted:" >> $LOGFILE_TMP
egrep [\<\>ch\.\*][fLDS][c\.\+\ \?][s\.\+\ \?][t\.\+\ \?][p\.\+\ \?][o\.\+\ \?][g\.\+\ \?][u\.\+\ \?][a\.\+\ \?][x\.\+\ \?] $LOGFILE_LOG >> $LOGFILE_TMP

# E-mail file to me
mail -s "Backup of plysch $DAYDATE" bjohv052@gmail.com < $LOGFILE_TMP

# Remove tmp file
$RM $LOGFILE_TMP

exit 0
March 20, 2008, at 12:39 PM by bjohv052 -- Added more info
Changed lines 22-23 from:

Since rsync is primarily a *nix tool, you need to get a Windows port. Of course, you could try a minimalist approach like cwRsync or DeltaCopy, but I advise you not to. The reason is that none of them gives you the tremendous benefit of bash scripting. Instead, install Cygwin on your machine. It's tried, tested, maintained and works. At least as far as I can tell.

to:

Since rsync is primarily a *nix tool, you need to get a Windows port. Of course, you could try a minimalist approach like cwRsync (http://www.itefix.no/cwrsync/) or DeltaCopy? (http://www.aboutmyip.com/AboutMyXApp/DeltaCopy.jsp), but I advise you not to. The reason is that none of them gives you the tremendous benefit of bash scripting. Instead, install Cygwin (http://www.cygwin.com/) on your machine. It's tried, tested, maintained and works. At least as far as I can tell.

Changed lines 25-26 from:

I followed the nice tutorial available here. But since I am not completely security paranoid I didn't follow all the steps.

to:

I followed the nice tutorial available at http://troy.jdmz.net/rsync/index.html. But since I am not completely security paranoid I didn't follow all the steps.

Changed lines 31-32 from:

Mike Rubel has an excellent tutorial on how to script incremental backups with rsync. I've ripped many ideas from him.

to:

Mike Rubel has an excellent tutorial (http://www.mikerubel.org/computers/rsync_snapshots/) on how to script incremental backups with rsync. I've ripped many ideas from him.

Added lines 44-178:

Remote side scripts

On the nslu2 side you may end up with something like this.

  1. !/bin/bash
  2. ------------- Variables ----------------------------------------------

RM=/bin/rm MV=/bin/mv LS=/bin/ls GREP=/bin/grep TAIL=/usr/bin/tail MKDIR=/bin/mkdir RSYNC=/usr/bin/rsync

NR_OF_DAILY=7 NR_OF_WEEKLY=4 NR_OF_MONTHLY=3 NR_OF_QUARTERLY=4

DAY=`date +%d` MONTH=`date +%m` DOW=`date +%u` DAYDATE=`date +m%d` LOGFILE_TMP=/tmp/"$DAYDATE"_tmp.log

  1. Which to shift?

if $DOW -eq 1 ? ; then

    SHIFT_WEEK=true
    if $DAY -le 7 ? ; then
        SHIFT_MONTH=true
        if $MONTH -eq 1 ? || $MONTH -eq 4 ? ||            $MONTH -eq 7 ? || $MONTH -eq 10 ? ; then
            SHIFT_QUARTER=true
        fi
    fi

fi

  1. ------------- The script itself --------------------------------------
  2. First, backup backup scripts in case WD MyBook? fails

$RSYNC -a --delete /home/bjorn/backup/scripts /home/bjorn/backup_scripts

  1. Perform first monday of every quarter

if $SHIFT_QUARTER = true ? ; then

    echo "First monday of quarter. Shifting quarterly." >> $LOGFILE_TMP
  1. Do for each backup job
    for job in $@ ; do
        SNAPSHOT=/home/bjorn/backup/$job
  1. Find latest monthly snapshot
        LATEST_MONTHLY=`$LS $SNAPSHOT | $GREP monthly | $TAIL -1`
  1. Shift snapshots
  2. Step 1: delete the oldest snapshot, if it exists
        if [ -d $SNAPSHOT/quarterly.$(($NR_OF_QUARTERLY - 1)) ] ; then
            $RM -rf $SNAPSHOT/quarterly.$(($NR_OF_QUARTERLY - 1))
        fi
  1. Step 2: shift the other snapshots(s) by one, if they exist
        for ((quarter = $(($NR_OF_QUARTERLY - 2)) ; quarter >= 0 ; quarter -= 1)) ; do
            if [ -d $SNAPSHOT/quarterly.$quarter ] ; then
                $MV $SNAPSHOT/quarterly.$quarter $SNAPSHOT/quarterly.$(($quarter + 1))
            fi
        done
  1. Step 3: move the latest monthly snapshot up to quarterly
    $MV $LATEST_MONTHLY $SNAPSHOT/quarterly.0
    done

fi

  1. Now, do the same for months on first monday of every month

if $SHIFT_MONTH = true ? ; then

    echo "First monday of month. Shifting monthly." >> $LOGFILE_TMP

    for job in $@ ; do
        SNAPSHOT=/home/bjorn/backup/$job
        LATEST_WEEKLY=`$LS $SNAPSHOT | $GREP weekly | $TAIL -1`

        if [ -d $SNAPSHOT/monthly.$(($NR_OF_MONTHLY - 1)) ] ; then
            $RM -rf $SNAPSHOT/monthly.$(($NR_OF_MONTHLY - 1))
        fi

        for ((month = $(($NR_OF_MONTHLY - 2)) ; month >= 0 ; month -= 1)) ; do
            if [ -d $SNAPSHOT/monthly.$month ] ; then
                $MV $SNAPSHOT/monthly.$month $SNAPSHOT/monthly.$(($month + 1))
            fi
        done

    $MV $LATEST_WEEKLY $SNAPSHOT/monthly.0
    done

fi

  1. And for weeks on every monday

if $SHIFT_WEEK = true ? ; then

    echo "Monday. Shifting weekly." >> $LOGFILE_TMP

    for job in $@ ; do
        SNAPSHOT=/home/bjorn/backup/$job
        LATEST_DAILY=`$LS $SNAPSHOT | $GREP daily | $TAIL -1`

        if [ -d $SNAPSHOT/weekly.$(($NR_OF_WEEKLY - 1)) ] ; then
            $RM -rf $SNAPSHOT/weekly.$(($NR_OF_WEEKLY - 1))
        fi

        for ((week = $(($NR_OF_WEEKLY - 2)) ; week >= 0 ; week -= 1)) ; do
            if [ -d $SNAPSHOT/weekly.$week ] ; then
                $MV $SNAPSHOT/weekly.$week $SNAPSHOT/weekly.$(($week + 1))
            fi
        done

    $MV $LATEST_DAILY $SNAPSHOT/weekly.0
    done

fi

  1. Days shall always be shifted

for job in $@ ; do

    SNAPSHOT=/home/bjorn/backup/$job

    if [ -d $SNAPSHOT/daily.$(($NR_OF_DAILY - 1)) ] ; then
        $RM -rf $SNAPSHOT/daily.$(($NR_OF_DAILY - 1))
    fi

    for ((day = $(($NR_OF_DAILY - 2)) ; day >= 0 ; day -= 1)) ; do
        if [ -d $SNAPSHOT/daily.$day ] ; then
            $MV $SNAPSHOT/daily.$day $SNAPSHOT/daily.$(($day + 1))
        fi
    done

    $MKDIR $SNAPSHOT/daily.0

done

exit 0

March 17, 2008, at 12:26 PM by bjohv052 -- Added more info
Changed lines 34-36 from:
  1. Use rsync in daemon mode
    1. on the source side, pulling the backup to the source
    2. on the remote side, pushing the backup to the source
to:
  1. Use rsync in daemon mode, either
    • on the source side, pulling the backup to the source, or
    • on the remote side, pushing the backup to the source.
Changed lines 38-39 from:
  1. can also be done push or pull
to:
  • can also be done push or pull.
Changed lines 41-43 from:
  1. ssh encrypts the transfer
  2. the remote shell (ssh) requires an ssh server, which is alreade available on the remote machine. Pull would require installing OpenSSH? on the source machine.
to:
  • ssh encrypts the transfer
  • the remote shell (ssh) requires an ssh server, which is alreade available on the remote machine. Pull would require installing OpenSSH? on the source machine.
March 17, 2008, at 12:23 PM by bjohv052 -- Added more info
Changed lines 2-7 from:

Since two weeks now I have an automated setup that does incremental backups of all important data on my windows box and sends it all to my nslu2 on a remote location. This how-to is not finished, please check back regularly.

Caveats and Presumptions

About me

The nslu2 is my first (but certainly not my last) Linux box, an I am a bash scripting novice. Therefore, many of the things I describe here can undoubtedly be done in a more efficient way. Please correct me where I go wrong.

to:

Since a couple of weeks I have an automated setup that does incremental backups of all important data on my windows box and sends it all to my nslu2 on a remote location. This how-to is not finished, please check back regularly.

About This How-To

The nslu2 is my first (but certainly not my last) Linux box, and I am a bash scripting novice. Therefore, many of the things I describe here can undoubtedly be done in a more efficient way. Please correct me where I go wrong.

Changed lines 9-11 from:

About the Setup

The source machine is a desktop Windows box in my home running Windows XP Professional. The remote machine, receiver of the backup, is the nslu2 placed off-site in my employers server room.

to:

About the Setup

The source machine is a desktop Windows box in my home running Windows XP Professional. At any given time, it may be on, off or standby (S3).

The remote machine, receiver of the backup, is the nslu2 placed off-site in my employers server room running Debian. It is on 24/7.

Changed lines 28-29 from:

http://rsync.samba.org/

to:

Read the man pages at http://rsync.samba.org/. Yes, all of it!

Changed lines 31-43 from:

http://www.mikerubel.org/computers/rsync_snapshots/

to:

Mike Rubel has an excellent tutorial on how to script incremental backups with rsync. I've ripped many ideas from him.

There are a few different setups to consider when backing up with rsync.

  1. Use rsync in daemon mode
    1. on the source side, pulling the backup to the source
    2. on the remote side, pushing the backup to the source
  2. Use rscync daemon features via a remote shell connection
    1. can also be done push or pull

We will use the latter setup in a push fashion. The reasons are that

  1. ssh encrypts the transfer
  2. the remote shell (ssh) requires an ssh server, which is alreade available on the remote machine. Pull would require installing OpenSSH? on the source machine.
March 17, 2008, at 12:01 PM by bjohv052 --
Changed lines 26-28 from:

Step 3: Scripting it on the NSLU2 Side

Step 4: Scripting it on the Windows Side

to:

Step 3: Understanding rsync

http://rsync.samba.org/

Step 4: Scripting it

http://www.mikerubel.org/computers/rsync_snapshots/

March 17, 2008, at 09:42 AM by bjohv052 -- Added more info
Changed lines 21-22 from:

Since rsync is primarily a *nix tool, you need to get a Windows port. Of course, you could try a minimalist approach like cwRsync (http://www.itefix.no/cwrsync/) or DeltaCopy? (http://www.aboutmyip.com/AboutMyXApp/DeltaCopy.jsp), but I advise you not to. The reason is that none of them gives you the tremendous benefit of bash scripting. Instead, install Cygwin on your machine. It's tried, tested, maintained and works. At least as far as I can tell.

to:

Since rsync is primarily a *nix tool, you need to get a Windows port. Of course, you could try a minimalist approach like cwRsync or DeltaCopy, but I advise you not to. The reason is that none of them gives you the tremendous benefit of bash scripting. Instead, install Cygwin on your machine. It's tried, tested, maintained and works. At least as far as I can tell.

Changed lines 24-25 from:

http://troy.jdmz.net/rsync/index.html

to:

I followed the nice tutorial available here. But since I am not completely security paranoid I didn't follow all the steps.

March 17, 2008, at 09:38 AM by bjohv052 --
Changed lines 21-22 from:

Since rsync is primarily a *nix tool, you need to get a Windows port. Of course, you could try a minimalist approach like cwRsync or DeltaCopy, but I advise you not to. The reason is that none of them gives you the tremendous benefit of bash scripting. Instead, install Cygwin on your machine. It's tried, tested, maintained and works. At least as far as I can tell.

to:

Since rsync is primarily a *nix tool, you need to get a Windows port. Of course, you could try a minimalist approach like cwRsync (http://www.itefix.no/cwrsync/) or DeltaCopy? (http://www.aboutmyip.com/AboutMyXApp/DeltaCopy.jsp), but I advise you not to. The reason is that none of them gives you the tremendous benefit of bash scripting. Instead, install Cygwin on your machine. It's tried, tested, maintained and works. At least as far as I can tell.

Changed lines 24-25 from:
to:

http://troy.jdmz.net/rsync/index.html

March 17, 2008, at 08:53 AM by bjohv052 --
Changed lines 11-12 from:

The source machine is a desktop Windows box in my home running WinXP? Professional. The remote machine, receiver of the backup, is the nslu2 placed off-site in my employers server room.

to:

The source machine is a desktop Windows box in my home running Windows XP Professional. The remote machine, receiver of the backup, is the nslu2 placed off-site in my employers server room.

Changed line 27 from:

Step 4: Scripting it on the WinXP? Side

to:

Step 4: Scripting it on the Windows Side

March 17, 2008, at 08:52 AM by bjohv052 --
Changed lines 23-27 from:

Step 2: Talking to Your NSLU2 Without a Password

to:

Step 2: Talking to Your NSLU2 Without a Password

Step 3: Scripting it on the NSLU2 Side

Step 4: Scripting it on the WinXP? Side

March 17, 2008, at 08:35 AM by bjohv052 -- Added more info
Changed lines 21-22 from:

Since rsync is primarily a *nix tool, you need to get a Windows port. Of course, you could try a minimalist approach like CwRsync? or Deltacopy, but I advise you not to. The reason is that none of them gives you the tremendous benefit of bash scripting. Instead, install Cygwin on your machine. It's tried, tested, maintained and works. At least as far as I can tell.

to:

Since rsync is primarily a *nix tool, you need to get a Windows port. Of course, you could try a minimalist approach like cwRsync or DeltaCopy, but I advise you not to. The reason is that none of them gives you the tremendous benefit of bash scripting. Instead, install Cygwin on your machine. It's tried, tested, maintained and works. At least as far as I can tell.

March 17, 2008, at 08:26 AM by bjohv052 --
Changed lines 21-23 from:

Since rsync is primarily a *nix tool, you need to get a Windows port. Of course, you could try a minimalist approach like CwRsync? or Deltacopy, but I advise you not to. The reason is that none of them gives you the tremendous benefit of bash scripting. Instead, install Cygwin on your machine. It's tried, tested, maintained and works. At least as far as I can tell.

to:

Since rsync is primarily a *nix tool, you need to get a Windows port. Of course, you could try a minimalist approach like CwRsync? or Deltacopy, but I advise you not to. The reason is that none of them gives you the tremendous benefit of bash scripting. Instead, install Cygwin on your machine. It's tried, tested, maintained and works. At least as far as I can tell.

Step 2: Talking to Your NSLU2 Without a Password

March 17, 2008, at 08:25 AM by bjohv052 -- Added more info
Changed lines 2-3 from:

Since two weeks now I have an automated setup that does incremental backups of all important data on my windows box and sends it all to my nslu2 on a remote location (my firms server room). I intend to add more information here soon.

to:

Since two weeks now I have an automated setup that does incremental backups of all important data on my windows box and sends it all to my nslu2 on a remote location. This how-to is not finished, please check back regularly.

Changed lines 11-12 from:

We will be dealing with a desktop Windows box in my home running WinXP? Professional. The remote machine, receiver of the backup, is the nslu2 placed off-site in my employers server room.

to:

The source machine is a desktop Windows box in my home running WinXP? Professional. The remote machine, receiver of the backup, is the nslu2 placed off-site in my employers server room.

March 17, 2008, at 08:19 AM by bjohv052 -- Added more info
Changed lines 18-21 from:
  1. A neatly packaged report e-mailed to you after every backup.
to:
  1. A neatly packaged report e-mailed to you after every backup.

Step 1: Getting Cygwin

Since rsync is primarily a *nix tool, you need to get a Windows port. Of course, you could try a minimalist approach like CwRsync? or Deltacopy, but I advise you not to. The reason is that none of them gives you the tremendous benefit of bash scripting. Instead, install Cygwin on your machine. It's tried, tested, maintained and works. At least as far as I can tell.

March 17, 2008, at 08:02 AM by bjohv052 -- Added more info
Changed line 4 from:

Caveats and presumptions

to:

Caveats and Presumptions

Changed lines 6-7 from:

The nslu2 is my first (but certainly not my last) Linux box, nor have I had any previous serious experience in bash scripting. Therefore, many of the things I describe here can undoubtedly be done in a more efficient way. Please correct me where I go wrong.

to:

The nslu2 is my first (but certainly not my last) Linux box, an I am a bash scripting novice. Therefore, many of the things I describe here can undoubtedly be done in a more efficient way. Please correct me where I go wrong.

Changed lines 10-11 from:

About the setup

We will be dealing with a desktop Windows box in my home running WinXP? Professional. The remote machine, receiver of the backup, is the nslu2 placed off-site in my employers server room.

to:

About the Setup

We will be dealing with a desktop Windows box in my home running WinXP? Professional. The remote machine, receiver of the backup, is the nslu2 placed off-site in my employers server room.

The Details

First, let's figure out what we want. This how-to will give you the following:

  1. Automated backup performed at any interval with no user interaction.
  2. Incremental backups, meaning additional backups will take virtually no space at all if no changes have been made on the source machine.
  3. Configurable backup scheme (per hour, day, week and so on).
  4. A neatly packaged report e-mailed to you after every backup.
March 14, 2008, at 12:48 PM by bjohv052 -- Added more info
Changed line 4 from:

Caveats and presumption

to:

Caveats and presumptions

Added lines 8-9:

It has taken me a few weeks of self-study and trial and error to get this setup to work the way I want it. I encourage the reader to work in the same way. For that reason, I will not give a detailed outline of how to set things up for your system. Instead I will point to more information and leave it up to you to to the reading and trying.

March 14, 2008, at 12:44 PM by bjohv052 -- Added more info
Changed lines 2-9 from:

Since two weeks now I have an automated setup that does incremental backups of all important data on my windows box and sends it all to my nslu2 on a remote location (my firms server room). I intend to add more information here soon.

to:

Since two weeks now I have an automated setup that does incremental backups of all important data on my windows box and sends it all to my nslu2 on a remote location (my firms server room). I intend to add more information here soon.

Caveats and presumption

About me

The nslu2 is my first (but certainly not my last) Linux box, nor have I had any previous serious experience in bash scripting. Therefore, many of the things I describe here can undoubtedly be done in a more efficient way. Please correct me where I go wrong.

About the setup

We will be dealing with a desktop Windows box in my home running WinXP? Professional. The remote machine, receiver of the backup, is the nslu2 placed off-site in my employers server room.

March 14, 2008, at 12:29 PM by bjohv052 -- Article started
Added lines 1-2:

How To Backup Your Windows Files Remotely

Since two weeks now I have an automated setup that does incremental backups of all important data on my windows box and sends it all to my nslu2 on a remote location (my firms server room). I intend to add more information here soon.

view · edit · print · history · Last edited by bjohv052.
Originally by bjohv052.
Page last modified on March 25, 2008, at 11:21 AM