I do the same. But instead of rsyncing every certain interval I have the inotifywait utility watching the sync dirs for changes. Once a change is detected (pretty much immediate) inotifywait exits and the script enters the rsync loop which syncs the dirs to all the nodes, when rsync is done the script is again blocked by inotify until a change is detected.

#!/bin/sh

while true; do
inotifywait -r /var/www/web1 -r /var/www/web2 -e modify -e attrib -e close_write -e move -e create -e delete -qq

# Optionally add a small sleep here to let the change be completed or tweak the notifywait like to be less trigger happy
  sleep 5....

  do_rsync
done

You'd have to have Linux for that. On some other systems you can use stuff like FAM.

Marc

Brian Moon wrote:
Dan Miller wrote:
What are other people using in an environment where they need to share diskspace across a web farm. Thanks

We have some servers that are internal use only that are NFS mounted and then the NFS server is rsync'd with the public facing servers every 2 minutes.


Reply via email to