Using Subversion as a mirroring tool
I used to use CVS as a source control and to manage some of the static content on my website. I now upgraded to Subversion. The migration was pretty smooth, the only tricky part was to make my hook script work with SVN.
I added a post commit hook script that does an update in the root of my website. So basically, every time I commit a new file from anywhere it is automatically updated on my website… pretty cool.
Only problem I got was that hook scripts are run by the same user than the subversion command is, in my case the user that owns apache (which is the front end for my Subversion server). In order to update my local repository I had to add a sudo rule to allow the apache user to run the update script as the user who owns the website, because the apache user didn’t have the permission to run the subversion update on my website’s root directory.
Now all is working the way I want
Deprecated (old CVS blurb)
I use CVSto manage some of the content on my website. That give me the flexibility to revert if I make a mistake, but also allows me to track changes. The only problem I had was that I needed to remember to checkout the latest version on my web server so the website doesn't get out of sync.
In order to do that automatically I wrote a post commit script that checks out a file right after a new version of it gets committed. I used help from this page about CVS commit hooks to hook up my script to CVS' post-commit hook.
Now every time I commit a changed, the appropriate file gets updated or checked out on the web server.
I currently have only one web server (which is also my CVS server) so no mirroring is required, but this script could be updated to do its job on several mirrors over ssh if needed...