Synchronize files from and to host systems.
Project description
file sync tool
Python script to synchronize files from an origin to a target system using rsync.
This tool is an addon of the db-sync-tool.
Installation
Prerequisite
The script needs python 3.5 or higher. It is necessary for some additional functionalities to have pip installed on your local machine.
pip
The library can be installed from PyPI:
$ pip3 install file-sync-tool-kmi
composer
The script is also available via packagist.org using composer:
$ composer require kmi/file-sync-tool
Additionally install the python requirements via the following pip command:
$ pip3 install -e vendor/kmi/file-sync-tool/
Configuration
You can configure the script with shell arguments or using a separate configuration file.
Configuration File
The config.json
contains important information about the origin and the target system.
Example structure of config.json
in receiver mode :
{
"target": {},
"origin": {
"host": "ssh_host",
"user": "ssh_user"
},
"files": {
"config": [
{
"origin": "/var/www/html/files/",
"target": "/var/www/html/files/",
"exclude": [
"*.log"
]
}
]
}
}
Documentation
For further information see the documentation of the db-sync-tool.
Usage
Command line
Run the python script via command line.
Installed via pip:
$ python3 file_sync_tool
Installed via composer:
$ python3 vendor/kmi/file-sync-tool/file_sync_tool
Shell arguments
usage: file_sync_tool [-h] [-f CONFIG_FILE] [-v] [-m] [-o HOST_FILE]
A tool for automatic file synchronization from and to host systems.
optional arguments:
-h, --help show this help message and exit
-f CONFIG_FILE, --config-file CONFIG_FILE
Path to configuration file
-v, --verbose Enable extended console output
-m, --mute Mute console output
-o HOST_FILE, --host-file HOST_FILE
Using an additional hosts file for merging hosts
information with the configuration file
If 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.
Import
You can import the python package and use them inside your project:
from file_sync_tool import sync
if __name__ == "__main__":
sync.Sync(config={}, args*)
Build
The packaging process of the python module is described on python.org.
Tests
A docker container set up is available for testing purpose. See here.
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 file_sync_tool_kmi-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 971cea6b77c95f40cfa0174f5c85236a3e39917a549c7a0589905f5ff3a41763 |
|
MD5 | bc0664ccca00c4061d985a8e044b5a03 |
|
BLAKE2b-256 | 4c80782e3c54fa3ca0c7a544e93ef2459dd10bead7ec27ad2f07542a95f77149 |