If you’re using a CRON to control
rsync, you might run into a condition whereby the first
rsync CRON job hasn’t completed and another one starts off. It’s best to avoid this situation.
The way to avoid this problem is by using
flock. Flock manages locks from shell scripts.
Here is an example:
* * * * * /usr/bin/flock -n '/tmp/example.lock' -c 'rsync -azP /local_path [email protected]:/remote_path' > /dev/null