Git Product home page Git Product logo

machine-sync's Introduction

This repository provides a shell script that uses lsyncd to sync a folder live to one or multiple machines. It uses rsync, therefore a ssh connection to the machine is enough. The script also supports sending out notifications with a list of updated files plus sophisticated ignore mechanism. For other features and tips refer to the section about tips and features. The usage is simple:

  • msync start machine1 machine2: Syncs the current working directory to the home folder of machine1 and machine2.
  • msync or msync status: Lists running instances with their id.
  • msync stop <id>: Stops the sync session with id.

The script can be easily installed as a Nix package or can be installed manually. The Nix package has the advantage that all dependencies are automatically fetched.

Tips and Features

Notifications

msync sends out a notification with changed files on each change in the synced directory.

Image of notification sent out by msync.

Ignoring Files

msync reads and applies the excludes specified in .gitignore. When there are files that you want to force sync, add a comment line with # noldignore to your .gitignore. Every pattern that is listed after this comment, will be excluded when reading the .gitignore. Put any files that you want to exclude, but not via .gitignore, in a custom file called .ldignore. msync will read and apply the patterns in that file identical to patterns in .gitignore.

SSH Multiplexing

lsyncd, the tool that is used for synchronization, spawns rsync every time a change needs to be synchronized. This leads to problems with medium to high latency connections. I can in general recommend using SSH Multiplexing. That configuration makes any further connection attempts after the initial connection instant, since the already authorized session is used for the setup.

Nix package

Test it out without installation:

nix run github:fabian-thomas/machine-sync

Install it permanently:

nix profile install github:fabian-thomas/machine-sync

Manual installation

Dependencies (collected from default.nix and rsync-notify-multiple.nix):

  • coreutils
  • findutils
  • lsyncd
  • ps
  • libnotify
  • rsync
  • openssh

If you move the script to another place, set LSYNCD_TEMPLATE=/path/to/cloned/repo/template.lua.

machine-sync's People

Contributors

fabian-thomas avatar

Stargazers

Ruiyi Zhang avatar Daniel Weber avatar edd avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.