Giter VIP home page Giter VIP logo

docker-moveoncomplete's Introduction

MoveOnComplete

This simple tool, allows to specify an input folder to watch and an output folder to copy files to, as soon as the file does not change any more. The changes to the file are watched using inotify with a Python wrapper.

Why?

I am using it in combination with Mayan-EDMS. The document scanner I use is capable of uploading files using SFTP. But while using it with Mayan, I discovered, that sometimes the file is not correctly imported. This happens if Mayan tries to work with the file, while it is still uploaded. As the scanner software is not a subject to change. I decided to build a small to that does one thing well.

How?

This docker image registers for inotify events in a folder structure (IWATCH_FROM). If there is anything written in that structure it keeps an entry with the filepath and the last time it has been written. Every time an event like MODIFY or CREATE happens the entry is updated. The inotify events created also contain None events. These occur after a configurable timeout(IWATCH_TIMEOUT). If there are no events for a time period longer or equal the timeout the file is moved to the target folder (IWATCH_TO).

Usage

Run the docker container with the following environment variables:

IWATCH_FROM

Folder to watch for new files and changes. (default: /in)

IWATCH_TO

Folder to move files to. (default: /out)

IWATCH_TIMEOUT

Timeout to wait for further changes (default: 30 Seconds).

COPYUSER_UID/COPYUSER_GID

User id of the file owner. The docker container ensures that all folders are writeable by setting this user/group as owner for input and output folder. (default: 1000)

Docker commandline

docker run -v <local path to in folder>:/in -v <local path to output>:/out moveoncomplete

docker-moveoncomplete's People

Contributors

m42e avatar dustins avatar

Watchers

James Cloos 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.