{"id":16768697,"url":"https://github.com/jackd248/file-sync-tool","last_synced_at":"2025-03-16T13:43:05.522Z","repository":{"id":57007664,"uuid":"324954752","full_name":"jackd248/file-sync-tool","owner":"jackd248","description":"Python script to synchronize files from an origin to a target system using rsync.","archived":false,"fork":false,"pushed_at":"2023-02-21T08:25:19.000Z","size":752,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T23:17:37.938Z","etag":null,"topics":["filesync","python","python3","rsync","sync","synchronization"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jackd248.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-28T08:25:26.000Z","updated_at":"2024-05-06T05:33:58.000Z","dependencies_parsed_at":"2022-08-21T14:31:23.494Z","dependency_job_id":null,"html_url":"https://github.com/jackd248/file-sync-tool","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackd248%2Ffile-sync-tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackd248%2Ffile-sync-tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackd248%2Ffile-sync-tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackd248%2Ffile-sync-tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jackd248","download_url":"https://codeload.github.com/jackd248/file-sync-tool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243878437,"owners_count":20362432,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["filesync","python","python3","rsync","sync","synchronization"],"created_at":"2024-10-13T06:12:17.262Z","updated_at":"2025-03-16T13:43:05.500Z","avatar_url":"https://github.com/jackd248.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# file sync tool\n\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/file_sync_tool-kmi)\n![PyPI](https://img.shields.io/pypi/v/file_sync_tool-kmi)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/jackd248/file-sync-tool/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/jackd248/file-sync-tool/?branch=master)\n[![Build Status](https://scrutinizer-ci.com/g/jackd248/file-sync-tool/badges/build.png?b=master)](https://scrutinizer-ci.com/g/jackd248/file-sync-tool/build-status/master)\n\nPython script to synchronize files from an origin to a target system using [rsync](https://linux.die.net/man/1/rsync).\n\nThis tool is an addon of the [db-sync-tool](https://github.com/jackd248/db-sync-tool).\n\n![Example receiver](docs/images/file-sync-tool-example-receiver.gif)\n\n## Installation\n\n### Prerequisite\n\nThe script needs [python](https://python.org/) __3.5__ or higher. It is necessary for some additional functionalities to have [pip](https://pypi.org/project/pip/) installed on your local machine. \n\n\u003ca name=\"install-pip\"\u003e\u003c/a\u003e\n### pip\nThe library can be installed from [PyPI](https://pypi.org/project/file-sync-tool-kmi/):\n```bash\n$ pip3 install file-sync-tool-kmi\n```\n\n\u003ca name=\"install-composer\"\u003e\u003c/a\u003e\n### composer\nThe script is also available via [packagist.org](https://packagist.org/packages/kmi/file-sync-tool) using composer:\n\n```bash\n$ composer require kmi/file-sync-tool\n```\n\nAdditionally install the python requirements via the following pip command:\n\n````bash\n$ pip3 install -e vendor/kmi/file-sync-tool/\n````\n\n## Configuration\n\nYou can configure the script with [shell arguments](#shell-arguments) or using a separate configuration file.\n\n### Configuration File\n\nThe `config.json` contains important information about the origin and the target system. \n\nExample structure of `config.json` in receiver mode :\n```json\n{\n  \"target\": {},\n  \"origin\": {\n    \"host\": \"ssh_host\",\n    \"user\": \"ssh_user\"\n  },\n  \"files\": {\n    \"config\": [\n      {\n        \"origin\": \"/var/www/html/files/\",\n        \"target\": \"/var/www/html/files/\",\n        \"exclude\": [\n          \"*.log\"\n        ]\n      }\n    ]\n  }\n}\n```\n\n### Documentation\n\nExtend the `config.json` with a `files` section containing multiple transfer entries within the `config`entry. Therefore you have to specify the `origin` source path as well as the `target` destination path of the file sync. Additionally define the rsync `exclude`s for this specific transfer.\n\nIn the `config` entry you can also define additional rsync `option`s as a list overwriting the default options.\n\nFor further information see the documentation of the [db-sync-tool](https://github.com/jackd248/db-sync-tool).\n\n## Usage\n\n### Command line\n\nRun the python script via command line.\n\nInstalled via [pip](#install-pip):\n```bash\n$ file_sync_tool\n```\n\nInstalled via [composer](#install-composer):\n```bash\n$ python3 vendor/kmi/file-sync-tool/file_sync_tool\n```\n\n\u003ca name=\"shell-arguments\"\u003e\u003c/a\u003e\n#### Shell arguments\n\n```bash\nusage: file_sync_tool [-h] [-f CONFIG_FILE] [-v] [-m] [-o HOST_FILE]\n                      [-th TARGET_HOST] [-tu TARGET_USER]\n                      [-tpw TARGET_PASSWORD] [-tk TARGET_KEY]\n                      [-tpo TARGET_PORT] [-oh ORIGIN_HOST] [-ou ORIGIN_USER]\n                      [-opw ORIGIN_PASSWORD] [-ok ORIGIN_KEY]\n                      [-opo ORIGIN_PORT] [-fo FILES_ORIGIN] [-ft FILES_TARGET]\n                      [-fe FILES_EXCLUDE] [-fop FILES_OPTION]\n\nA tool for automatic file synchronization from and to host systems.\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -f CONFIG_FILE, --config-file CONFIG_FILE\n                        Path to configuration file\n  -v, --verbose         Enable extended console output\n  -m, --mute            Mute console output\n  -o HOST_FILE, --host-file HOST_FILE\n                        Using an additional hosts file for merging hosts\n                        information with the configuration file\n  -th TARGET_HOST, --target-host TARGET_HOST\n                        SSH host to target system\n  -tu TARGET_USER, --target-user TARGET_USER\n                        SSH user for target system\n  -tpw TARGET_PASSWORD, --target-password TARGET_PASSWORD\n                        SSH password for target system\n  -tk TARGET_KEY, --target-key TARGET_KEY\n                        File path to SSH key for target system\n  -tpo TARGET_PORT, --target-port TARGET_PORT\n                        SSH port for target system\n  -oh ORIGIN_HOST, --origin-host ORIGIN_HOST\n                        SSH host to origin system\n  -ou ORIGIN_USER, --origin-user ORIGIN_USER\n                        SSH user for origin system\n  -opw ORIGIN_PASSWORD, --origin-password ORIGIN_PASSWORD\n                        SSH password for origin system\n  -ok ORIGIN_KEY, --origin-key ORIGIN_KEY\n                        File path to SSH key for origin system\n  -opo ORIGIN_PORT, --origin-port ORIGIN_PORT\n                        SSH port for origin system\n  -fo FILES_ORIGIN, --files-origin FILES_ORIGIN\n                        File path for origin source of file sync\n  -ft FILES_TARGET, --files-target FILES_TARGET\n                        File path for target destination of file sync\n  -fe FILES_EXCLUDE, --files-exclude FILES_EXCLUDE\n                        Excludes for file sync\n  -fop FILES_OPTION, --files-option FILES_OPTION\n                        Additional rsync options\n```\n\nIf you haven't declare a path to a SSH key, during the script execution you are requested to enter the SSH password for the given user in the shell argument or the `config.json` to enable a SSH connection for the remote system. \n\n### Import\n\nYou can import the python package and use them inside your project:\n\n```python\nfrom file_sync_tool import sync\n\nif __name__ == \"__main__\":\n    sync.Sync(config={}, args*)\n```\n\n## Release Guide\n\nA detailed guide is available to release a new version. See [here](docs/RELEASE.md).\n\n## Tests\n\nA docker container set up is available for testing purpose. See [here](tests/README.md).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackd248%2Ffile-sync-tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackd248%2Ffile-sync-tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackd248%2Ffile-sync-tool/lists"}