Skip to main content

Python Version PyPI Downloads Wheel Development Status Tests Coverage Status Code style: black

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/config.conf

This source directory must contain a synchro.conf file which contains the information needed for the transfer. Including:

  • source - Where the data comes from (contents of directory will be copied) e.g. /path/to/source_directory)
  • 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 from synchro.conf.
  • permissions - Permissions for the destination file, in the chmod numerical format. e.g. 777. This option is ignored and defaults to 770 if the line is missing from synchro.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 from synchro.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 from synchro.conf.

Example:

source = /path/to/source_directory
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 called synchro
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/config_1.conf
/home/user/miniconda3/envs/synchro/bin/synchro /path/to/config_2.conf

This will then try to backup the directories specified in config_1.conf & config_2.conf every hour.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

synchro-0.0.3.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

synchro-0.0.3-py2.py3-none-any.whl (15.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file synchro-0.0.3.tar.gz.

File metadata

  • Download URL: synchro-0.0.3.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for synchro-0.0.3.tar.gz
Algorithm Hash digest
SHA256 288b1194f6be8635c84c249ecbd76bda7bdc1756d7e760362af79c7d4d5a3dba
MD5 0ca70628315fabfc48350217d61aef8d
BLAKE2b-256 8a2b9ba7239964dddd5ad0ed0e77f5f392230e9befe44be3520b318f844dec1d

See more details on using hashes here.

File details

Details for the file synchro-0.0.3-py2.py3-none-any.whl.

File metadata

  • Download URL: synchro-0.0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for synchro-0.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 30370ab9de563c26a5c9d12187f3695223aae236b59e2c6ab28f00a25e0e9c4f
MD5 6950f934eb3f7f2747e04862dad5ea19
BLAKE2b-256 786ae94d1138878cac8928393d68c4cbf9f5641a6b5d6c5911695c1695e85325

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page