Customisable file transfers using rsync
Project description
synchro
Customisable file transfers using rsync
About
Synchro is a simple python-based tool for customisable file movements, e.g. copying data to a backup server.
Synchro currently supports/includes:
- Transfer via ssh
- Archiving using tar (and option extraction)
- Option to only transfer data when a specific file is present
- Logging to file
To install
To install, you need a Unix-based system with Python (>=3.9) installed, and then:
pip install synchro
However, it is recommended to install conda (e.g. miniconda) first and create a new environment:
conda create --name synchro python=3.10
conda activate synchro
pip install synchro
If you don't have rsync installed, you will need to do so. E.g. on macOS it can be installed with homebrew:
brew install rsync
To use
synchro
has two modes of use on the command line, either with flags, or a config file.
Command line flags
Not yet implemented
Config file
The only input is the path to a source directory (the one being transferred).
synchro /path/to/source_directory
This source directory must contain a synchro.conf
file which contains the
information needed for the transfer. Including:
destination
- Where to move the data to e.g./path/to/destination_directory
)tar
- Tar the data before copying? e.g.y
untar
- Untar the data after copying? e.g.y
create_dest
- Create the destination directory if it doesn't exist? e.g.y
transfer_ready_file
- A file that must exist in the source directory (or relative path) for the transfer to initative. This option is ignored if the line is missing fromsynchro.conf
.permissions
- Permissions for the destination file, in the chmod numerical format. e.g.777
. This option is ignored and defaults to770
if the line is missing fromsynchro.conf
.owner
- Username for ownership of the transferred files. This option is ignored and defaults to that of the source directory if the line is missing fromsynchro.conf
.group
- Group for ownership of the transferred files. This option is ignored and defaults to that of the source directory if the line is missing fromsynchro.conf
.
Example:
destination = /path/to/destination_directory
tar = y
untar = y
create_dest = y
transfer_ready_file = ready.txt
permissions = 777
owner = user1
group = staff
N.B. the destination can also be on a remote host (an ssh key must be set up), e.g.:
destination = user@IP:/path/to/destination_directory
To use with cron
N.B. This assumes you've installed in a conda environment
Example - running file transfers hourly (tested on CentOS)
- Create a text file in
/etc/cron.hourly
calledsynchro
cd /etc/cron.hourly
touch synchro
- Add
synchro
commands to the text file using the full path to the synchro executable
/home/user/miniconda3/envs/synchro/bin/synchro /path/to/directory1
/home/user/miniconda3/envs/synchro/bin/synchro /path/to/directory2
This will then try to backup directory1
& directory2
every hour.
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.
Source Distribution
Built Distribution
Hashes for synchro-0.0.2rc0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab3df2f65b46971b07692ea7ddc7764ffea7b3cfde6b0e6c3d8ac936b4c80049 |
|
MD5 | 08108f25c94aeb66b4901d680c08275b |
|
BLAKE2b-256 | 35a4af26afc4b324eb4bccaef5905080aa4e604583603d57e692e237eb706a17 |