Find the answer to your Linux question:
Results 1 to 3 of 3
Hi All, We have CRON getting rsync to sync files between a desktop debian/squeez box and a nginx web server, however as we have CRON running sync every 15 minutes, ...
  1. #1
    Just Joined!
    Join Date
    Apr 2011
    Posts
    2

    Exclamation Rsync problem

    Hi All,

    We have CRON getting rsync to sync files between a desktop debian/squeez box and a nginx web server, however as we have CRON running sync every 15 minutes, if a sync is in progress another sync on the same files will start. If the files to sync are large (say video size) we could end up having many sync sessions running which ends up bringing down the server.

    In addition to that, if a file is being uploaded to the server to be sync'd with the box, rsync could end up running multiple session on that file too.

    Does anybody know a way to prevent a new sync from starting until all other syncs are complete? Or if another sync starts, only checks files that are not currently being sync'd?

    Hope all that makes sense, pretty new to this myself.

    Thanks

  2. #2
    Just Joined!
    Join Date
    Mar 2005
    Location
    Corona, CA
    Posts
    29
    1. If rsyncs are overlapping, don't run them so close to each other.
    2. On the server with the cronjob, put the rsync command in a script. Have the script create an empty file somewhere like /tmp, and then start rsync. When rsync finishes, rm the empty file. Now up above all that put an if statement that checks for that file. If the file exists, exit. If the file doesn't exist, create the file and start the rsync.

  3. #3
    Just Joined!
    Join Date
    Apr 2011
    Posts
    2
    Thanks, all sorted now

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •