Finally syncing and saving the way I want

Found out how to use RSYNC tunnelling over SSH to manage upload for this whole blog.

I'm sure there will be proper documentation on this sometime soon, but just a note in the margin for the time being.

I've succeeded at versioning my website using rsync through SSH access (with a regular cheap utility web host).

This means that I can maintain my website on my desktop from anywhere in the world, and no matter how big it gets, only the changes I make will be uploaded to the server. This means that even when the whole blog is redesigned, with every page having a few characters modification, the whole thing will synchronise in seconds, ignoring all the video files, photos and heavy duty upload stuff, unless one of them has actually changed, in which case it will be automatically synced.

More detail

For your edification, here is the 'upload.sh' script I'm using, which can sit in the top of any directory, and sync files with the remote directory. Of course, you'll have to replace the fake details with your own...



#!/bin/bash

rsync -vz --recursive --exclude='.svn' --exclude='upload.sh' -e ssh --rsync-path=/home/username/bin/rsync ./ username@host.com:/path/to/website

        

And make sure this version of rsync is in the location specified by --rsync-path, and that the user can log in to the server using ssh. To make it even more seamless, you can avoid typing the password by setting up ssh logins without passwords.

Where I am now

This is now part of my blog build process, so after editing any content, I can just type... ant publish ...and it will rebuild the whole website from source through the XSLT stylesheets I'm using and synchronise just the changes in the output files.

Thanks are due to...

Thanks to all on the #svn channel at irc.freenode.net who helped me find this elegant solution, and the maintainer of rsync-static for sharing an RPM, whose guts I ripped out with BetterZip and cpio in order to get a statically linked rsync binary which would run on a chrooted web host.

Tagged:

scripting (6)

rsync

ssh

hosting

publishing