cronning rsync

Adrian Ho aho-sw-rsync at 03s.net
Thu Jun 20 06:24:02 EST 2002


On Thu, Jun 20, 2002 at 12:51:14PM +0100, matthew.2.burgess at bt.com wrote:
> We're thinking about putting rsync to use in our production environment.
> What we want to do is have a cron job running on a client that replicates
> files on the host every five minutes.  We believe that some of the files
> will take longer than five minutes to complete.

Then you'll want to ensure that only one rsync instance is active
at a time.  This is best done with an external locking mechanism.
My personal favorite is setlock, part of Dan Bernstein's daemontools
package <http://cr.yp.to/daemontools.html>, and your setlock'd cron job
might look like this:

0-55/5 * * * * setlock -n /tmp/.rsync.lock rsync <blah blah blah>

Your OS may have similar functionality already available, and other
3rd-party packages may also have rolled their own equivalents (I know
both procmail and maildrop did) -- "man -k lock" to see for yourself.

- Adrian




More information about the rsync mailing list