What happens if you run the same rsync command twice
I have a somewhat silly question. Say I have an rsync job setup in cron to run every 4 hours. For example, say it's 4am and the cron job kicks off. What happens if at 4:15am that cron'd rsync is still running, and someone logs on to the server and runs the exact same rsync command manually?
Will this cause issues or bad data? Will the user manually running it have something pop up on the screen saying that rsync is already doing something in these folders or anything? If it matters, I usually use these options when I rsync (took it from one that was already setup by someone else on another server of mine) -razpv -e ssh |
I don't think anything will really happen - the files that were already synced will not be resynced as they already match for being updated.
You MIGHT get duplicate copying... but the one that finishes last will be the final copy, and the only way they would differ would be if the file changed while the first copy was being made, and the second copy got the updated blocks. The only time corruption should occur is if the second rsync gets aborted in the middle of copying - it might truncate the file (I'm not sure though). |
I'm also thinking it might not be a huge deal, but really I'm not sure.
|
If it's between two locally mounted filesystems, I suspect you could probably get away with it. But, if either filesystem is remote (so that rsync tries to transmit diffs rather than whole files), I have bad feelings about what might happen if one instance calculates a diff and transmits it, but the other instance has updated the file in the meantime.
|
if the first rsync is still running the 2nd one will not be allowed to run, you can only have one instance of rsync running at a time. its not a big deal.
|
Quote:
|
That's a good point about a remote vs local rsync
|
All times are GMT -5. The time now is 04:25 PM. |