![]() |
HowTo.BackupYourWindowsFilesRemotely HistoryHide minor edits - Show changes to markup March 25, 2008, at 11:21 AM
by -- 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 -- 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 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 Changed line 364 from:
This is file to:
This is file Changed line 378 from:
Example e-mail report: to:
Example e-mail report. March 21, 2008, at 06:32 PM
by -- 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 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 -- 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 Changed line 150 from:
to:
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 -- 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:
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 DetailsFirst, let's figure out what we want. This how-to will give you the following:
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 Changed lines 157-158 from:
The files to:
The files 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 -- 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:
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 -- Added more info
Changed lines 64-84 from:
text here later @] The files This is file text here later Remote Side ScriptsOn the nslu2 side you may end up with something like this. This is script [@
to:
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
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
COUNTER=1 SRC_COUNTER=1 DEST_COUNTER=1
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:
if $SHIFT_QUARTER = true ? ; then echo "First monday of quarter. Shifting quarterly." >> $LOGFILE_TMP
for job in $@ ; do
SNAPSHOT=/home/bjorn/backup/$job
LATEST_MONTHLY=`$LS $SNAPSHOT | $GREP monthly | $TAIL -1`
if [ -d $SNAPSHOT/quarterly.$(($NR_OF_QUARTERLY - 1)) ] ; then
$RM -rf $SNAPSHOT/quarterly.$(($NR_OF_QUARTERLY - 1))
fi
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
$MV $LATEST_MONTHLY $SNAPSHOT/quarterly.0
done
to:
exec 4>&1 exec 6>&2 exec 1>>$LOGFILE_STD exec 2>>$LOGFILE_ERR
sleep 30
$SSH_COMMAND $LOCATION /home/bjorn/backup/scripts/prepare_backup.sh $DEST_ALL
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`."
exec 1>&4 4>&- exec 2>&6 6>&-
$SCP_COMMAND $LOGFILE_STD bjorn@$LOCATION:/home/bjorn/backup/logs/"$DAYDATE"_std.log
if [ -s $LOGFILE_ERR ] ; then $SCP_COMMAND $LOGFILE_ERR bjorn@$LOCATION:/home/bjorn/backup/logs/"$DAYDATE"_err.log Changed lines 140-200 from:
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
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
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:
$RM $LOGFILE_STD $RM $LOGFILE_ERR
$SSH_COMMAND $LOCATION /home/bjorn/backup/scripts/finish_backup.sh Changed lines 151-153 from:
This is script to:
The files This is file 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 ScriptsOn the nslu2 side you may end up with something like this. This is script [@ 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:
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:
echo >> $LOGFILE_STD echo "Printout from df -h:" >> $LOGFILE_STD df -h >> $LOGFILE_STD
$HEAD -1 $LOGFILE_STD >> $LOGFILE_TMP $TAIL -9 $LOGFILE_STD >> $LOGFILE_TMP echo >> $LOGFILE_TMP
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:
if $SHIFT_QUARTER = true ? ; then echo "First monday of quarter. Shifting quarterly." >> $LOGFILE_TMP
for job in $@ ; do
SNAPSHOT=/home/bjorn/backup/$job
LATEST_MONTHLY=`$LS $SNAPSHOT | $GREP monthly | $TAIL -1`
if [ -d $SNAPSHOT/quarterly.$(($NR_OF_QUARTERLY - 1)) ] ; then
$RM -rf $SNAPSHOT/quarterly.$(($NR_OF_QUARTERLY - 1))
fi
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
$MV $LATEST_MONTHLY $SNAPSHOT/quarterly.0
done
Changed lines 235-247 from:
echo >> $LOGFILE_TMP
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
mail -s "Backup of plysch $DAYDATE" my.email.address@gmail.com < $LOGFILE_TMP
$RM $LOGFILE_TMP to:
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
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
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 AutomationTo 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 This is file to:
This is script Changed lines 303-349 from:
text here later to:
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
echo >> $LOGFILE_STD echo "Printout from df -h:" >> $LOGFILE_STD df -h >> $LOGFILE_STD
$HEAD -1 $LOGFILE_STD >> $LOGFILE_TMP $TAIL -9 $LOGFILE_STD >> $LOGFILE_TMP echo >> $LOGFILE_TMP
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
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
mail -s "Backup of plysch $DAYDATE" my.email.address@gmail.com < $LOGFILE_TMP
$RM $LOGFILE_TMP exit 0 Added lines 353-364:
Step 5: Further AutomationTo 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 This is file text here later March 20, 2008, at 02:07 PM
by -- 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:
to:
Changed line 18 from:
to:
Changed line 30 from:
Step 4: Scripting itto:
Step 4: Scripting ItChanged lines 35-36 from:
to:
Changed lines 40-44 from:
We will use the latter setup in a push fashion. The reasons are that
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 scriptsto:
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 ScriptsChanged line 77 from:
Remote side scriptsto:
Remote Side ScriptsChanged line 265 from:
Step 5: Further automationto:
Step 5: Further AutomationChanged lines 268-270 from:
In the task scheduler, schedule the machine to run the file to:
In the task scheduler, schedule the machine to run the file This is file Changed line 279 from:
Example e-mail reportto:
Example E-mail ReportAdded line 282:
Example e-mail report: March 20, 2008, at 01:40 PM
by -- Added more info
Changed lines 64-67 from:
Remote side scriptsOn the nslu2 side you may end up with something like this. This is script to:
This is script Added lines 67-85:
text here later @] The files This is file text here later Remote side scriptsOn the nslu2 side you may end up with something like this. This is script [@ March 20, 2008, at 01:27 PM
by -- 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 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 -- 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 -- Added more info
Changed line 48 from:
to:
Changed lines 53-56 from:
to:
Added lines 251-344:
Step 5: Further automationExample e-mail reportfrom 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 -- Added more info
Changed lines 42-43 from:
to:
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:
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 scriptsOn the Windows side you may end up with something like this. March 20, 2008, at 12:50 PM
by -- 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 -- Added more info
Changed line 47 from:
This is script to:
This is script Deleted lines 84-86:
$RSYNC -a --delete /home/bjorn/backup/scripts /home/bjorn/backup_scripts Changed line 179 from:
This is script to:
This is script 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 -- Added more info
Added line 47:
This is script Added line 49:
[@ Changed line 179 from:
to:
@] Added lines 181-232:
This is script
#!/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 -- 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 scriptsOn the nslu2 side you may end up with something like this.
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
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
$RSYNC -a --delete /home/bjorn/backup/scripts /home/bjorn/backup_scripts
if $SHIFT_QUARTER = true ? ; then echo "First monday of quarter. Shifting quarterly." >> $LOGFILE_TMP
for job in $@ ; do
SNAPSHOT=/home/bjorn/backup/$job
LATEST_MONTHLY=`$LS $SNAPSHOT | $GREP monthly | $TAIL -1`
if [ -d $SNAPSHOT/quarterly.$(($NR_OF_QUARTERLY - 1)) ] ; then
$RM -rf $SNAPSHOT/quarterly.$(($NR_OF_QUARTERLY - 1))
fi
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
$MV $LATEST_MONTHLY $SNAPSHOT/quarterly.0
done
fi
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
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
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 -- Added more info
Changed lines 34-36 from:
to:
Changed lines 38-39 from:
to:
Changed lines 41-43 from:
to:
March 17, 2008, at 12:23 PM
by -- 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 PresumptionsAbout meThe 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-ToThe 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 SetupThe 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 SetupThe 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.
We will use the latter setup in a push fashion. The reasons are that March 17, 2008, at 12:01 PM
by --
Changed lines 26-28 from:
Step 3: Scripting it on the NSLU2 SideStep 4: Scripting it on the Windows Sideto:
Step 3: Understanding rsynchttp://rsync.samba.org/ Step 4: Scripting ithttp://www.mikerubel.org/computers/rsync_snapshots/ March 17, 2008, at 09:42 AM
by -- 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 --
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 --
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:
to:
Step 4: Scripting it on the Windows SideMarch 17, 2008, at 08:52 AM
by --
Changed lines 23-27 from:
Step 2: Talking to Your NSLU2 Without a Passwordto:
March 17, 2008, at 08:35 AM
by -- 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 --
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 PasswordMarch 17, 2008, at 08:25 AM
by -- 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:
March 17, 2008, at 08:19 AM
by -- Added more info
Changed lines 18-21 from:
to:
Step 1: Getting CygwinSince 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 -- Added more info
Changed line 4 from:
Caveats and presumptionsto:
Caveats and PresumptionsChanged 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 setupWe 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 SetupWe 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 DetailsFirst, let's figure out what we want. This how-to will give you the following:
March 14, 2008, at 12:48 PM
by -- Added more info
Changed line 4 from:
Caveats and presumptionto:
Caveats and presumptionsAdded 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 -- 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 presumptionAbout meThe 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 setupWe 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 -- Article started
Added lines 1-2:
How To Backup Your Windows Files RemotelySince 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. |