Anyone have any relatively simple instructions for setting up adn/or usingA crontab entry something like this should do the trick:
rsync to synchronize html files between 2 webservers?
_____
Sincerely,
Jamil Hassan Spain
NC School of Science and Mathematics | External Programs Phone: 919-416-2641
Web: www.dlt.ncssm.edu <http://www.dlt.ncssm.edu/> Email: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> _____
*/2 * * * * /usr/local/bin/rsync -a --delete -e ssh --exclude 'files/*/to/exclude' /path/to/local/files/ <remotemachine>:/remote/path/to/store/
This will sync the directory on the local host with the remote host every 2 minutes. It will always consider the local host to be authoritative, and if something is deleted locally, it will delete it remotely on the next sync. If something is changed on the remote side, it will get blown away on the next sync.
A few things to consider:
If you use the "-e ssh" switch you'll need to ensure that you can login to the remote host without requiring a password, as the user that the cron job is running as. For more information `man sshd` - that's beyond the scope of your question.
If you don't use "-e ssh" (and thus don't funnel it over an ssh tunnel) you'll need to setup rsyncd on the remote host. Haven't done it personally, as I've always done it the other way.
I just saw David M.'s post right before I went to hit send. Note that -a preserves permissions.
As always, `man rsync` for more info, and some relatively good straight-forward examples.
Aaron J.
-- TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug TriLUG Organizational FAQ : http://trilug.org/faq/ TriLUG Member Services FAQ : http://members.trilug.org/services_faq/ TriLUG PGP Keyring : http://trilug.org/~chrish/trilug.asc
