Posts

Showing posts from March, 2012

rsync with CDN and purge

I recently had to setup a new CDN for, using Edgecast, They support rsync for content and also have an API, so I started with cron'd full rsync, but this was taking too long, so I moved to rsync only recently changed files, and used the output to do a flush of the cache for updated files. Edgecast provide a really good CDN solution, and also provide EU based rsync endpoints for getting your logs and pushing your content #!/bin/sh set -e rm -rf /tmp/rsync.ec.out rm -rf /tmp/changedfiles #move to directory so path names are good in outputs cd /opt/www/htdocs/ #find recently modified files find . -mmin -120 > /tmp/changedfiles #run rsync for these changed files, only changing existing files and logging output /usr/bin/rsync --itemize-changes -az --existing -e "ssh -i /home/rsync/.ssh/my_special_id_rsa -p8022 -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no" --files-from=/tmp/changedfiles /opt/www/htdocs/ user@domain@rsync.ams.edgecastcdn.net:/content/mysubdi