File sync utility
Project description
Synecure
Synecure provides a command line program called sy that allows easy synchronization of files and directories over SSH between different machines. It is mostly a wrapper around bsync, which is itself based on the standard UNIX tool rsync.
This is beta software and comes with NO GUARANTEES that it will keep your data safe. It should not be used as backup solution.
Install
pip install synecure
Usage
# Sync local ~/directory with remote $HOME/directory on me@awesome.person
sy ~/directory -r me@awesome.person
# Sync current directory with the same path on me@awesome.person, port 2222
sy -r me@awesome.person -p 2222
# Synchronize to a named remote from your SSH config
sy -r me
# Synchronize the current directory to the last used remote (for that directory)
sy
By default, sy can take on any path within your $HOME and will set the corresponding path on the remote's $HOME. It is possible to change this behavior or synchronize paths outside of $HOME using the sy-config add-path command.
sy with no argument will sync the current directory using the last remote for that directory (you will need to use the -r flag the first time, but not subsequently).
Howto
Ignore files
Add a .bsync-ignore file in the root directory to sync with a filename or glob pattern on each line, and they will be ignored. It works more or less like .gitignore.
Putting .bsync-ignore files in subdirectories to ignore files in these subdirectories will unfortunately not work, so sy ~/x and sy ~/x/y may synchronize the contents of ~/x/y differently if both directories contain different .bsync-ignore files, or if one has an ignore file and the other does not.
Global ignores
The sy-config ignore command can be used to generally ignore files or directories:
# Edit the ignore file using $EDITOR, if it is set
sy-config ignore
# List all existing ignores
sy-config ignore -l
# Ignore all files that end with ~
# Do not forget the single quotes here, to avoid shell expansion!
sy-config ignore '*~'
# Unignore files that end with ~
sy-config ignore -r '*~'
The ignores work mostly like .gitignore or .bsync-ignore above, but they apply globally. Note that sy will also read remote-side global ignores when syncing to a remote. Global ignores are located at $HOME/.config/synecure/ignore, so a remote can define some global ignores even without installing sy remote-side. Global ignores local-side, remote-side, as well as .bsync-ignore files local-side and remote-side are all merged together.
Customize synchronization paths
To synchronize local /etc to remote /etcetera, for named remote desktop:
sy-config add-path desktop /etc /etcetera
Obviously, this will only work if the remote user has the permissions to write to /etcetera. You can have multiple remotes for the same host with different users, if that helps.
To synchronize local ~/hello to remote ~/bonjour:
sy-config add-path desktop ~/hello bonjour
Don't use ~ for the remote path, it will complete to the wrong thing.
To list available remotes and paths:
sy-config list
Sync local directories
sy-config add dropbox file://~/Dropbox
Other options
Dry run
Use the -n flag to perform a "dry run": sy (well, bsync) will report all the transfers that would occur but it will not perform them.
Use --show-plan to get the sequence of commands that sy will run.
Conflict resolution
Whenever a file was modified on both ends since the last sync, sy will ask which one you want to keep.
Use sy <options> --resolve local (or sy <options> -1) to always keep the local file without prompting, or --resolve remote (or -2) to always keep the remote file.
List directories
sy -l will list all directories that have been previously synced using the tool, along with the last remote they were synced to (remember that sy without the -r option will sync to the last remote).
Configuration files
~/.config/synecure/remotes.jsondefines protocols and paths for named remotes.- You can open an editor for that file with
sy-config edit
- You can open an editor for that file with
~/.config/synecure/ignorelists global ignores.- You can open an editor for that file with
sy-config ignore
- You can open an editor for that file with
~/.config/synecure/directories.jsonmaps directories to last used remotes.~/.ssh/configis the standard location to define host information forssh.- For convenience, you can open an editor for that file with
sy-config ssh
- For convenience, you can open an editor for that file with
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file synecure-0.2.1.tar.gz.
File metadata
- Download URL: synecure-0.2.1.tar.gz
- Upload date:
- Size: 21.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.9.1 Darwin/20.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ee20d610343d77fffdefa3dda158e1a949522a311f57764f77b208256bfe906
|
|
| MD5 |
79c3b22064d6e985efa00bc60af77c4a
|
|
| BLAKE2b-256 |
3da832fd4274f986343b886a36c01b61c817b7722b1a37e93ed2a17bb9f15be9
|
File details
Details for the file synecure-0.2.1-py3-none-any.whl.
File metadata
- Download URL: synecure-0.2.1-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.9.1 Darwin/20.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ccdb24b07e2888baccdf170fca554fd05369d0a4107059b69cbbbc731fa3a1d
|
|
| MD5 |
b02b2002a6946dcd42230909ec4658e3
|
|
| BLAKE2b-256 |
148ab441e68a6ef396cd99b9ba13566ca0e1db220ff35e4460388586b44ff8c9
|