Originally Posted by matts76
Thanks. We need it for high availability more than anything else. You are correct in that it IS running multiple instances of itself and killing the CPU, but we don't want to run it any less often for data protection reasons. After doing some research we're leaning towards DRBD. Do you guys have any experience with this tool? Anything we should watch out for? Thanks!
I think you missed the point in my post. If a second instance kicks off before the first one completes you're not really getting the file(s) as often as you think. The first one has to complete to free up the resources for the second one to run. Running it so often buys you nothing and as you've seen in terms of performance costs you plenty.
Instead of cron to do the rsync I'd suggest:
1) Create a script that does an infinite while loop:
while true do
rsync ... (whatever your rsync command line is)
2) Create another script that verifies the above is running and put this other script in cron (every 15 minutes would do I should think).
The first script does the rsync until the end of time because "true" is always true. The cron job just makes sure the first script restarts if it should fail for any reason (like after a system reboot).
The "sleep 300" says to wait 5 minutes after the first rsync completes until the next one starts. You don't even have to wait 5 minutes. Just putting in "sleep 60" waiting a minute will let it start a minute later. Even a "sleep 1" would be better than nothing.
Also do NOT put an ampersand (&) at the end of the rsync line. The & tells it to run asynchronously. You WANT it to be synchronous so that the next run follows the completion AND the sleep.