Skip to content

ebzzry/usync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Usync

Overview

Usync is a simple site-to-site synchronization program written in Scsh. It makes use of unison, and rsync, for bi- and uni-directional synchronizations, respectively.

Prerequisites

  • scsh ≥ 0.7
  • rsync ≥ 3.1
  • unison ≥ 2.48

Installation

If you’re using Nix, run:

$ nix-env -i usync

or

$ nix-env -iA $(nix-channel --list | awk '{print $1}').usync

If that doesn’t work, or if you’re not using Nix, do the following.

To install it to the current user:

$ mkdir -p ~/bin
$ curl -SLo ~/bin/usync https://raw.githubusercontent.com/ebzzry/usync/master/usync
$ chmod +x ~/bin/usync

To install it globally:

# curl -SLo /usr/local/bin/usync https://raw.githubusercontent.com/ebzzry/usync/master/usync
# chmod +x /usr/local/bin/usync

Usage

To perform two-way synchronization of the directory /pub/yot/ninam, between the current host, to the hosts tarupam, and taubetmo, while preserving the directory structure remotely (take note, that there must be no spaces between the hosts specification, due to the IFS environment variable, found in most shells):

$ usync /pub/yot/ninam/ tarupam,taubetmo

The command above will perform two-way synchronization of the diretory ninam/ found under /pub/yot/, to tarupam:/pub/yot/, and taubetmo:/pub/yot/.

Using our example above, the two-way synchronization system basically tells that if the tree tarupam:/pub/yot/ninam/ contains new and/or updated items, compared with localhost:/pub/yot/ninam/, and localhost:/pub/yot/ninam/ also happens to have new and/or updated items, then, they will trade updates.

Ideally, the result is that localhost:/pub/yot/ninam/, tarupam:/pub/yot/ninam/, and taubetmo:/pub/yot/ninam/, are all equal.

It is also possible to perform synchronization of multiple files, and directories, to remote hosts. To do so, run:

$ usync /pub/yot/ninam/ ~/file.text ~reyn/*.blend tarupam,taubetmo

The command above will perform two-way synchronization of the paths /pub/yot/ninam/, ~/file.text, and ~reyn/*.blend to the remote hosts tarupam, and taubetmo, using the same directory structuring system described above.

If you want to perform one-way synchronization, of the above, like rsync, run:

$ usync --one-way --prefer-local /pub/yot/ninam/ ~/file.text ~reyn/draft.blend tarupam,taubetmo

For more usage information, run:

$ usync --help

Credits

Thanks to Riastradh for helping me with Scheme48’s module system.

About

Site-to-site synchronization utility

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages