J-RSYNC
J-Rsync is a python wrapper on unix rsync which uses a json configuration file to identify what to sync. The tool was designed to solve the problem of recurrently synchronising many directories or files
Using a single command from crontab, it is possible to keep synchronized many paths.
Installation
Via PIP
pip install jrsync
Via MAMBA/CONDA
mamba install jrsync
Usage
usage: jrsync [-h] [--src-address SRC_ADDRESS] [--dst-address DST_ADDRESS]
[--force] [-o OPTIONS] [-d--dry-run] [-V]
config date_to_sync
Jrsync CLI
positional arguments:
config Json file containing sync information
date_to_sync Date in the format YYYYMMDD
options:
-h, --help show this help message and exit
--src-host SRC_HOST
Source host. Example: user@remote
--dst-host DST_HOST
Dest host. Example: user@remote
--force Allow to run multiple instance in the same moment
-o OPTIONS, --options OPTIONS
Rsync options. use -o|--options= to avoid conflicts
with python args
-d--dry-run Enable dry run mode
-V, --version Print version and exit
Remote synchronization
As default, the tool assumes that the path are local, but both source and destination path can be located on a remote server. Be carefully that only one path can be remote
Sync from remote to local
To synchronize files from remote to local computer:
jrsync <config> <date> --src-host user@remote
Sync from local to remote
To synchronize files from local to remote:
jrsync <config> <date> --dst-host user@remote
Rsync options
As default, rsync runs with the following options:
-aP
They can be changed using -o|--options:
jrsync <config> <date> --options="-avug"
Configuration File
Attributes
The configuration file is a json file which contains a list of Jsync objects with the following attributes:
source_dir: The directory on the source host from which files will be synchronized.dest_dir: The directory on the destination host where files will be synchronized.day(optional): Specifies the day of the week when the synchronization should be executed, following crontab convention. For example:- "*": Every day.
- "0": Sunday.
- "1": Monday, and so on.
src_host(optional): The source host from which files will be synced. If not provided, files will be synced from the local machine. It can be provided as an argument from CLIdst_host(optional): The destination host where files will be synced. If not provided, files will be synced to the local machine. It can be provided as an argument from CLIfile_to_sync(optional): A list of specific files to be synchronized. If this field is omitted, all files in source_dir will be synchronized. Conditional Behavior: If src_host is None, only files that exist in the source_dir will be synchronized.
Dynamic Placeholders:
{{DATE}}: Replaces with the value of date to sync passed as argument from CLI.{{DATE + X}}: Replaces with the date X days after date_to_sync.{{DATE - X}}: Replaces with the date X days before date_to_sync.- Global Variables: You can also use global variables in this field.
Example
[
{
"source_dir": "/data/{{DATE - 1}}",
"dest_dir": "/backup/{{DATE}}",
"day": "*",
"file_to_sync": ["important_file.txt", "logs/{{DATE - 1}}.log"]
}
]
Authors
- Antonio Mariani (antonio.mariani@cmcc.it)
Contributing
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
Contact
For any questions or suggestions, please open an issue on the project's GitHub repository.
Metadata
Release files for jrsync 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jrsync-0.1.7.tar.gz | 14.7 kB | Without provenance | Details for jrsync-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jrsync-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for jrsync-0.1.7-py3-none-any.whl |
Total release size: 32.3 kB
Release files / jrsync-0.1.7.tar.gz
| Download URL | jrsync-0.1.7.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
35e7c87c5fff68ecb8ed5a60c7e6e85c34d6a57eddbdf293ac12a0b7721cf535
|
|
BLAKE2b-256 checksum How to use checksums |
a1b4623883fa63f301be15dc4a05d74a91e7ac896b91983fb5ef4107ac2b0616
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1019-oem
|
Release files / jrsync-0.1.7-py3-none-any.whl
| Download URL | jrsync-0.1.7-py3-none-any.whl |
|---|---|
| Size | 17.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fd62642f63fede7fa321cfe1eaf9967bd5661a1ef9b5481b75f4619bab7135ed
|
|
BLAKE2b-256 checksum How to use checksums |
6fad35ba33e9df021e9744c72287aa57d24416d1817378df3c9235b2b4ef8a75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.10.14 Linux/6.5.0-1019-oem
|
Security for jrsync 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.