Git Product home page Git Product logo

workonsh's Introduction

workonsh

A live synchronizer local and remote machine. Similar to lsyncd

Install

Requirements: fswatch and rsync.

To install from pypi

pip install workonsh

From git repo

pip install git+https://github.com/ngocbh/workonsh

Usage

Run workonsh --help

An example to create a session:

workonsh -n <project_name> -s <source-dir> -d <dest-dir> -e "*__pycache__" -f .gitignore -i 5

workonsh's People

Contributors

ngocbh avatar marsoft avatar

Stargazers

 avatar Eric Aguilera avatar  avatar

Watchers

 avatar

Forkers

marsoft

workonsh's Issues

File changed during synchronization is not synced

Consider the following: 2 files were changed almost simultaneously - A, then B. File A is large enough.
fswatch detects that file A is changed and tells us. We find out that file A was changed and start rsync.
Now, rsync runs for long enough, and during that files B and C are changed too.
After rsync has finished, we set last_synced time to the current time (i.e. to the time when rsync has finished) and find out the next line from fswatch telling us that file B is changed, too.
We check current time and find that just a little moment has passed since we did the last sync (as we check synchronization end time, not synchronization start time). So we don't run rsync.

Now, nothing is changed for a long time. And directories are out of sync: file A is synchronized but file B isn't.
This will only be fixed after some other file is changed, which may happen not very soon.

What we should do IMO: if no new changes happen for rsync_interval seconds but we know about some non-synchronized data then still run rsync.
This will complicate the code logic, and simple for line in ... loop won't work in this scenario. But it will avoid having directories unsynchronized for too long.

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.