A zc.buildout recipe to copy data from one location to another
Project description
Introduction
collective.recipe.rsync is a zc.buildout recipe that copies files between two places via the rsync program.
It was originally created to copy a Data.fs file between two Plone environments (from production to development). But you can use it to copy any file or set of files; e.g. ZODB blob files, and so on.
Installation
Add a section to your buildout.cfg file, e.g. filestorage:
[buildout] parts = ... filestorage [filestorage] recipe = collective.recipe.rsync source = aclark@aclark.net:/srv/aclark/var/filestorage/Data.fs target = var/filestorage/Data.fs
Run buildout; you should see:
Running rsync... rsync -av --partial --progress aclark@aclark.net:/srv/aclark/var/filestorage/Data.fs var/filestorage/Data.fs this may take a while! ...
Specify alternate SSH port
Optionally, you may specify an alternate SSH port for rsync to use:
[filestorage] recipe = collective.recipe.rsync source = aclark@aclark.net:/srv/aclark/var/filestorage/Data.fs target = var/filestorage/Data.fs port = 22001
Run buildout; you should see:
Running rsync... rsync -e 'ssh -p 22001' -av --partial --progress aclark@aclark.net:/srv/aclark/var/filestorage/Data.fs var/filestorage/Data.fs this may take a while! ...
Create a script
Optionally, you may create a rsync script to execute later. Just configure script = true like so:
[sample] recipe = collective.recipe.rsync source = sample_input.txt target = sample_input_copy.txt script = true
Run buildout; you should see:
$ bin/buildout ... Installing sample. Generated script '/Users/aclark/Developer/collective/collective.recipe.rsync/bin/rsync-sample'.
Notice that rsync is no longer executed when you run buildout. You may now run the rsync script whenever you like:
$ bin/rsync-sample ... Running rsync... rsync -e 'ssh -p None' -av --partial --progress sample_input.txt sample_input_copy.txt this may take a while! ...
Further, you may now execute an rsync script automatically via cron (see: http://pypi.python.org/pypi/z3c.recipe.usercrontab).
Example
Here are the contents of a sample database.cfg file; this example demonstrates how to copy a Data.fs file and var/blobstorage files:
[buildout] extends = buildout.cfg parts += filestorage blobstorage [filestorage] recipe = collective.recipe.rsync source = aclark.net:/srv/aclark_net_website/var/filestorage/Data.fs target = var/filestorage/Data.fs [blobstorage] recipe = collective.recipe.rsync source = aclark.net:/srv/aclark_net_website/var/blobstorage/ target = var/blobstorage
Contact
Questions/comments/concerns? Please e-mail: aclark@aclark.net.
Changelog
1.7 (2011-01-21)
Doc fixes
Make script name based on section name
Support more than one script in the same buildout
1.6 (2011-01-20)
Add script option
Generates bin/rsync script
Disables rsync during buildout execution
Facilitates creation of scheduled rsyncs via cron
1.5 (2011-01-10)
Doc fixes
Add a note about UNIX compat only
1.4 (2011-01-10)
Support alternate ssh port parameter in recipe section. This allows collective.recipe.rsync to execute rsync with: -e ‘ssh <port>’, which facilitates copying over non-standard ssh ports.
1.3 (2010-12-19)
Fix docs
1.2 (2010-12-19)
Fix docs
Add new test harness
Clean up package
1.1 (2010-11-05)
Modified output to include rsync command line being executed
1.0 (2010-02-28)
Rename package from collective.recipe.rsync_datafs to collective.recipe.rsync
0.1 (2009-08-26)
Created recipe with ZopeSkel
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.