Local data synchronization tool based on rsync.
Project description
MICSYNC - local discs synchronisation tool
Micsync is a tool that provides easy management of data kept on the disc and its backup or backups. It uses rsync for all file operations. Verbose option will show the exact rsync command used.
micsync on PyPi: https://pypi.org/project/micsync/
Installation
If you are using pacman package manager (on Arch linux and derived systems), prefer installation with pacman over pip. If you install package with pip, pacman doesn't see it and it may lead to conflicts in future when installing or updating other packages.
Using git and makepkg (for pacman users)
git clone https://github.com/micdmy/micsync.git
cd micsync/archive-pkgbuild/<last version>/
makepkg -sir
Replace <last version>
with actual directory name.
Using pip
As root:
pip install micsync
Learn more: python - installing packages
Using git and python-setuptools
git clone https://github.com/micdmy/micsync.git
cd micsync/
./build.sh
cd output/offline-PKGBUILD/
tar -xzf micsync*
cd micsync*/
As root:
python setup.py install --optimize=1
Check if micsync was installed succesfully
micsync --version
How to use it
Micsync allows to configure WORKING and BACKUP locations. Location is a directory in filesystem and all subdirectories and files it contains.
There are two types of locations which serve different purposes:
-
WORKING location - examples of use
- Location on disc that's backup can be kept in BACKUP.
- Workplace from which some files/directories can be send to BACKUP.
- Temporary cache for some data needed at the moment, that are kept on BACKUP all the time (i.e. when BACKUP is on external hard disc).
-
BACKUP location - examples of use
- Can be used as backup copy of things in WORKING location.
- Can be used as source of data for other BACKUPs (mirrors).
- Data from BACKUP can be copied back to WORKING, or even override or remove data there.
- BACKUP directories structure (tree, skeleton) can be copied (without files) to WORKING.
Any number of WORKINGs can be linked with any number of BACKUPs. One CONFIGURATION links together WORKINGs and BACKUPs. WORKINGs and BACKUPs in one CONFIGURATION cannot overlap (i.e. WORKING contains BACKUP).
There may be a lot of CONFIGURATIONs that don't influence each other. User sets the CONFIGURATIONs up in ".micsync.json" file located in user's home directory.
Example of .micsync.json file:
{
"configs": [
{
"name": "My first CONFIGURATION, it contains 1 WORKING and 1 BACKUP",
"work": [
"/home/example_user/some_dir/"
],
"backup": [
"/example/path/"
]
},
{
"name": "My second CONFIGURATION, it contains 2 WORKINGs and 3 BACKUPs",
"work": [
"/home/example_user/some_dir/",
"~/other/"
],
"backup": [
"/a/backup/",
"./it/may/be/relative/path/",
"~/my/third/backup/"
]
}
]
}
Command line interface
Command syntax
micsync <sync-action> [options] <paths>
micsync <other-action>
<sync-action>
tells micsync what kind of the synchronization operation should be performed between locations.
Currently, there are 4 synchronization actions defined:
--backup
--work
--transfer
--tree
<other-action>
are actions that don't perform any operations on files in defined locations:
--version
- prints the program version
[options]
are specific for each action.
They are used, for example, to define what micsync do with modified files or if it can delete files.
<paths>
is a path or space-separated list of paths to directories or files that exist within some of defined configurations.
All of the given paths must be within defined configurations.
It doesn't matter if a path is in WORKING or BACKUP location. It doesn't influence the direction of copying.
You can tell micsync to, for example, do --backup
operation, specifying path in BACKUP or in WORKING. In each case, copying from WORKING to BACKUP will be performed. The direction is defined by <sync-action>
, not by <paths>
.
Synchronization actions
-
--backup
- Copies files and directories in
<paths>
from WORKING to all accessible BACKUPs. - Asks which WORKING to choose if many are accessible.
- It never deletes anything in BACKUP. Lists new.
- Lists modified and asks for confirmation.
- Options:
-m -s -v
- Source: WORKING
- Destination: all accessible BACKUPS
- Copies files and directories in
-
--work
- Copies files and directories in
<paths>
from chosen BACKUP to chosen WORKING. - Asks which WORKING and/or BACKUP to choose if many are accessible.
- Lists to-delete and asks for confirmation.
- Lists modified and asks for confirmation.
- Options:
-m -d -D -s -v
- Source: WORKING
- Destination: BACKUP
- Copies files and directories in
-
--transfer
- Copies files and directories from chosen src BACKUP to chosen dst BACKUP.
- Asks to confirm or choose destination and source BACKUPS.
- Lists to-delete and asks for confirmation.(Only if -d ? - TODO: check it)
- Lists modified and asks for confirmation.
- Options:
-m -d -D -s -v
- Source: BACKUP
- Destination: BACKUP
-
--tree
- Copy directories empty structure from backup to work and/or update existing.
- Options:
-s -v
- Source: BACKUP
- Destination: WORKING
Options for synchronization actions
Copying options:
-m
Copy modified (overwrite) without asking.-d
Delete files in dst if they don't exist in src. Ask before deleting.-D
Delete files in dst if they don't exist in src. Don't ask before deleting. If-d
and-D
specified, works as if only-D
was specified.
User interface and verbosity options:
-s
Suppress information about modifying directories.-v
Verbose mode. Shows rsync command used to perform synchronization. Asks before doing anything.
Bug reporting
Have you found a bug? Please, report it here.
Information for developers
If you are a developer and want to contribute to micsync, you're welcomed! Don't hesitate to contact the author if you have questions.
Required software:
linux operating system
rsync
pacman
python >= 3.7
python-pip
python-pytest
python-wheel
twine
git
Getting source code
git clone https://github.com/micdmy/micsync.git
Workflow - development and testing on local machine
- Make the changes.
- Run
./build.sh
and see if there are any errors in output. - Enter the directory with package for local (offline) installation:
cd output/offline-PKGBUILD/
- Install with makepkg:
makepkg -sir
- Run tests from main repository directory. See: tests/README.md.
- Do some manual tests.
- Commit/push changes.
Workflow - releasing version
- You're ready with 'development and testing on local machine'.
- Change version number in file micsync/version.py.
- Clean previous build artifacts with
./clean.sh
. - Run
./build.sh
. You will be warned that git tag is not updated. Ignore it, pressy
and enter. See if there are any errors in output. - Run
./deploy-pip.sh
.output/dist/micsync-0.0.4.dev0-py3-none-any.whl
andoutput/dist/micsync-0.0.4.dev0.tar.gz
will be sent tohttps://pypi.org/project/micsync/
. You will be asked for credentials. - Run
./deploy-aur.sh
. PKGBUILD file will be added toarchive-pkgbuild/<new version>/
. - Stage
archive-pkgbuild/
andmicsync/version.py
. - Commit, add tag
<new version>
and push with tags.
Workflow - testing released version
- Uninstall old version of micsync with pacman or pip.
- Install new version with pip. Run automatic tests. Make manual tests. Uninstall micsync.
- Install new version with pacman or makepkg. Run automatic tests. Make manual tests.
Project organization
Directory / File | In git repo | Purpose |
---|---|---|
./micsync/ |
Yes. | Source code. |
./micsync/version.py |
Yes | Contains version and program name. Version from this file is taken as program version by build.sh |
.tests/ |
Yes. | Automatic tests source code. |
./archive-pk-pkgbuild/ |
Yes. | Storage for PKGBUILD files for every version. |
./output/ |
No. | After build, contains all build artifacts. Removed with clean.sh |
./output/offline-PKGBUILD/ |
No. | After build, contains the packaged program and specially prepared PKGBUILD file for local (offline) installation. |
./build.sh |
Yes. | Script that builds the program. |
./clean.sh |
Yes. | Script that cleans the build artifacts. |
./deploy-aur.sh |
Yes | Script that copies output/PKGBUILD to archive-pkgbuild/<new version>/ . |
./deploy-pip.sh |
Yes | Script that sends new version to PyPi/micsync. |
./micsync/version.py |
Yes | Contains version and program name. Version from this file is taken as program version by build.sh |
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
File details
Details for the file micsync-0.0.4.dev1.tar.gz
.
File metadata
- Download URL: micsync-0.0.4.dev1.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07f1fd342a1a2acfa0f041dd87b328428ac3ec5c88c4d5ef666a60b42d66aaaf |
|
MD5 | ed9dc5eaa9ccc7fe7bc17bbe6c6992d9 |
|
BLAKE2b-256 | d112ed2c26f8e36dd22d377c228523f77d6ff9fc7529f12e74fca5a605f8d1da |
File details
Details for the file micsync-0.0.4.dev1-py3-none-any.whl
.
File metadata
- Download URL: micsync-0.0.4.dev1-py3-none-any.whl
- Upload date:
- Size: 28.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0edff3062a63c87d0fe6bf7f926348b1d5c5def64f5cb11936b9d066dbd58240 |
|
MD5 | 4ea04da5561931fd98c97be6db6bc7e0 |
|
BLAKE2b-256 | 7cc1d94d778171cdb1053115b3c13a406ea9119b9b97804adace57fee7ef82d4 |