Automated Backups

I recently wrote about Backup Options but never mentioned how I actually kicked off the backups.

I use a crontab to start my backups, it looks like this:

@daily unison -times -batch /home/anton/Documents ssh://MyServer/Documents -servercmd /home/anton/bin/unison >> $HOME/cron.unison.log 2>&1
@weekly rsync –stats -auv –delete –exclude “*.db” –exclude “*/.pics/” “/home/anton/My Photos/” home:”~/My Photos/” >> $HOME/cron.rsync.log 2>&1

I am sure you can achieve this under windows with either cywin (which you will probably want for a good command line ssh client/unison anyway) or with the scheduled tasks and a batch file.

The commands are fairly simple, and redirect all output to cron..log (the “>>” redirect means it will append to the file and “2>&1” will redirect all errors as well)

Rsync lets me exclude certain files. In this case I am excluding windows .db files (windows explorer thumbnails) and .pics directories (Digikam thumbnails), though I could copy them too.

The reason my photos are weekly as opposed to daily is because I might change/add enough photos for the upload to take more than 24 hours on a slow broadband connection (I do not want two scripts running at once, though there are defenitely better ways of achieving this i.e. writing a script to do the backup that checks for a lockfile)

About Anton Piatek

Professional bit herder, amateur photographer. Linux and tech geek
This entry was posted in Internet, Linux. Bookmark the permalink.

2 Responses to Automated Backups

  1. Jason Arnotte says:

    I found your blog post while searching for windows rsync and unison packages.

    I wanted to mention rsync.net, which supports Unison (and rsync, obviously). My wife is a pro photographer and I put all of her pictures there for safe keeping. Hope they can be of use to you, because I want their business to thrive. Look at their philosophy and privacy/warrant pages and you’ll see why…

  2. Anton says:

    In my last post I actually mention rsync.net, but thanks for mentioning it too.
    Safely storing pictures is always a bit hard, but with digital you can back them up somehwere else very easily.

Leave a Reply