Giter Site home page Giter Site logo

banan's Introduction

Banan: a simple queued job runner

Install

Requires Go version ≥ 1.21.7.

$ go install github.com/pietv/banan@latest

Execution

Banan (basque: "one by one", "separately") executes the command right away or waits for another instance of that command to complete (if that command has been run using banan). The command is identified by the name of the executable (for example: for a command line bash -c echo 123 the identification name is bash).

Banan consults the log to check if other instances are being run at the moment. The name of the log file is the name of the executable minus the file extension. When the log is written, it is locked using the operating system's file locking mechanisms.

By default, the log file is created in the $TMPDIR directory; that can be overridden with the --log-dir flag.

$ banan --log-dir=. -- bash -c echo running; sleep 2&
$ banan --log-dir=. -- bash -c echo running; sleep 2&
$ banan --log-dir=. -- bash -c echo running; sleep 2
$ cat bash.log
{"time":"2024-04-09 12:12:56 UTC","state":"Processing","pid":45772}
{"time":"2024-04-09 12:12:56 UTC","state":"Done","pid":45772,"system_time":"1.288ms","user_time":"702µs"}
{"time":"2024-04-09 12:12:56 UTC","state":"Processing","pid":45781}
{"time":"2024-04-09 12:12:56 UTC","state":"Done","pid":45781,"system_time":"1.92ms","user_time":"1.119ms"}
{"time":"2024-04-09 12:12:56 UTC","state":"Processing","pid":45790}
{"time":"2024-04-09 12:12:56 UTC","state":"Done","pid":45790,"system_time":"1.874ms","user_time":"997µs"}

banan's People

Contributors

wabahaba avatar

Watchers

Peter Vypov avatar  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.