jrsync


Namejrsync JSON
Version 0.1.7 PyPI version JSON
download
home_pageNone
SummaryJSON Configurable wrapper on unix rsync
upload_time2024-08-14 12:53:47
maintainerNone
docs_urlNone
authorAntonio Mariani
requires_python<4.0,>=3.10
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.

![Python](https://img.shields.io/badge/Python->3.10-blue.svg)
[![Anaconda](https://img.shields.io/badge/conda->22.11.1-green.svg)](https://anaconda.org/)
[![Pip](https://img.shields.io/badge/pip->19.0.3-brown.svg)](https://pypi.org/project/pip/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://docs.pydantic.dev/latest/contributing/#badges)
[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)

---

## Installation

### Via PIP

```shell
pip install jrsync
```

### Via MAMBA/CONDA

```shell
mamba install jrsync
```

---

## Usage

```shell
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:

```shell
jrsync <config> <date> --src-host user@remote
```

#### Sync from local to remote

To synchronize files from local to remote:

```shell
jrsync <config> <date> --dst-host user@remote
```

### Rsync options

As default, rsync runs with the following options:

```shell
-aP
```

They can be changed using `-o|--options`:

```shell
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 CLI
* `dst_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 CLI
* `file_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

```shell
[
{
    "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.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "jrsync",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Antonio Mariani",
    "author_email": "antonio.mariani@cmcc.it",
    "download_url": "https://files.pythonhosted.org/packages/a1/b4/623883fa63f301be15dc4a05d74a91e7ac896b91983fb5ef4107ac2b0616/jrsync-0.1.7.tar.gz",
    "platform": null,
    "description": "# J-RSYNC\n\nJ-Rsync is a python wrapper on unix rsync which uses a json configuration file to identify what to sync.\nThe tool was designed to solve the problem of recurrently synchronising many directories or files\n\nUsing a single command from crontab, it is possible to keep synchronized many paths.\n\n![Python](https://img.shields.io/badge/Python->3.10-blue.svg)\n[![Anaconda](https://img.shields.io/badge/conda->22.11.1-green.svg)](https://anaconda.org/)\n[![Pip](https://img.shields.io/badge/pip->19.0.3-brown.svg)](https://pypi.org/project/pip/)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://docs.pydantic.dev/latest/contributing/#badges)\n[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)\n\n---\n\n## Installation\n\n### Via PIP\n\n```shell\npip install jrsync\n```\n\n### Via MAMBA/CONDA\n\n```shell\nmamba install jrsync\n```\n\n---\n\n## Usage\n\n```shell\nusage: jrsync [-h] [--src-address SRC_ADDRESS] [--dst-address DST_ADDRESS]\n              [--force] [-o OPTIONS] [-d--dry-run] [-V]\n              config date_to_sync\n\nJrsync CLI\n\npositional arguments:\n  config                Json file containing sync information\n  date_to_sync          Date in the format YYYYMMDD\n\noptions:\n  -h, --help            show this help message and exit\n  --src-host SRC_HOST\n                        Source host. Example: user@remote\n  --dst-host DST_HOST\n                        Dest host. Example: user@remote\n  --force               Allow to run multiple instance in the same moment\n  -o OPTIONS, --options OPTIONS\n                        Rsync options. use -o|--options= to avoid conflicts\n                        with python args\n  -d--dry-run           Enable dry run mode\n  -V, --version         Print version and exit\n\n```\n\n### Remote synchronization\n\nAs default, the tool assumes that the path are local, but both source and destination path can be located on a remote\nserver.\n**Be carefully that only one path can be remote**\n\n#### Sync from remote to local\n\nTo synchronize files from remote to local computer:\n\n```shell\njrsync <config> <date> --src-host user@remote\n```\n\n#### Sync from local to remote\n\nTo synchronize files from local to remote:\n\n```shell\njrsync <config> <date> --dst-host user@remote\n```\n\n### Rsync options\n\nAs default, rsync runs with the following options:\n\n```shell\n-aP\n```\n\nThey can be changed using `-o|--options`:\n\n```shell\njrsync <config> <date> --options=\"-avug\"\n```\n\n---\n\n## Configuration File\n\n### Attributes\n\nThe configuration file is a json file which contains a list of Jsync objects with the following attributes:\n\n* `source_dir`: The directory on the source host from which files will be synchronized.\n* `dest_dir`: The directory on the destination host where files will be synchronized.\n* `day` (optional): Specifies the day of the week when the synchronization should be executed, following crontab\n  convention. For example:\n  * \"*\": Every day.\n  * \"0\": Sunday.\n  * \"1\": Monday, and so on.\n* `src_host` (optional): The source host from which files will be synced. If not provided, files will be synced from the\n  local machine. It can be provided as an argument from CLI\n* `dst_host` (optional): The destination host where files will be synced. If not provided, files will be synced to the\n  local machine. It can be provided as an argument from CLI\n* `file_to_sync` (optional): A list of specific files to be synchronized. If this field is omitted, all files in\n  source_dir will be synchronized.\n  Conditional Behavior: If src_host is None, only files that exist in the source_dir will be synchronized.\n\n### Dynamic Placeholders:\n\n* `{{DATE}}`: Replaces with the value of date to sync passed as argument from CLI.\n* `{{DATE + X}}`: Replaces with the date X days after date_to_sync.\n* `{{DATE - X}}`: Replaces with the date X days before date_to_sync.\n* Global Variables: You can also use global variables in this field.\n\n### Example\n\n```shell\n[\n{\n    \"source_dir\": \"/data/{{DATE - 1}}\",\n    \"dest_dir\": \"/backup/{{DATE}}\",\n    \"day\": \"*\",\n    \"file_to_sync\": [\"important_file.txt\", \"logs/{{DATE - 1}}.log\"]\n}\n]\n\n```\n\n---\n\n## Authors\n\n- Antonio Mariani (antonio.mariani@cmcc.it)\n\n---\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.\n\n---\n\n## Contact\n\nFor any questions or suggestions, please open an issue on the project's GitHub repository.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "JSON Configurable wrapper on unix rsync",
    "version": "0.1.7",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6fad35ba33e9df021e9744c72287aa57d24416d1817378df3c9235b2b4ef8a75",
                "md5": "66801efb7d0128292af89cfffd954601",
                "sha256": "fd62642f63fede7fa321cfe1eaf9967bd5661a1ef9b5481b75f4619bab7135ed"
            },
            "downloads": -1,
            "filename": "jrsync-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "66801efb7d0128292af89cfffd954601",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 17613,
            "upload_time": "2024-08-14T12:53:45",
            "upload_time_iso_8601": "2024-08-14T12:53:45.777099Z",
            "url": "https://files.pythonhosted.org/packages/6f/ad/35ba33e9df021e9744c72287aa57d24416d1817378df3c9235b2b4ef8a75/jrsync-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a1b4623883fa63f301be15dc4a05d74a91e7ac896b91983fb5ef4107ac2b0616",
                "md5": "14c8b91af31b764d48fe42afbb43f2f9",
                "sha256": "35e7c87c5fff68ecb8ed5a60c7e6e85c34d6a57eddbdf293ac12a0b7721cf535"
            },
            "downloads": -1,
            "filename": "jrsync-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "14c8b91af31b764d48fe42afbb43f2f9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 14696,
            "upload_time": "2024-08-14T12:53:47",
            "upload_time_iso_8601": "2024-08-14T12:53:47.369543Z",
            "url": "https://files.pythonhosted.org/packages/a1/b4/623883fa63f301be15dc4a05d74a91e7ac896b91983fb5ef4107ac2b0616/jrsync-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-14 12:53:47",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "jrsync"
}
        
Elapsed time: 0.36754s