GithubHelp home page GithubHelp logo

bashpoolthread's Introduction

BashPoolThread

BashPoolThread is a little script which provides some functions to control pools of background command

Installation

No installation is needed just download BT.sh or clone git repo and source the script to access to the function or exec the script to access with your command line

source ./BT.sh

OR

./BT.sh

Usage in a script ( source mode )

BT.sh provides some public functions : BTpoolNew poolname number

Add a new pool with name 'poolname' and 'number' workers

BTpoolStart poolname

Start pool 'poolname'. It start to execute command and wait new command

BTpoolStop poolname

Stop pool 'poolname'

BTpoolWait poolname

Wait pool 'poolname' has an empty command list

BTpoolList

List all pool created

BTpoolRemove poolname

Remove pool 'poolname'

BTcommandAdd poolname command

Add a new command in 'poolname'

BTcommandList poolname

List all command of pool 'poolname'

Usage in a terminal ( CLI mode )

./BT.sh pool
    new|n|add|a   poolname      : Add a new pool
    remove|r|delete|d  poolname : Remove a pool
    list|l                      : List pools
    exist|e poolname            : Exitcode 0 if poolname exist
    start poolname              : Start pool
    stop poolname               : Stop pool
    wait poolname               : Wait pool
./BT.sh command
    add|a poolname command      : Add a command to a pool
    list|l poolname             : List command of a pool

Example

source BT.sh

##Create a pool with 2 worker
BTpoolNew test 2

#Start pool
BTpoolStart test
>[1] 12643

for i in $(seq 1 5) ; do BTcommandAdd test touch /tmp/$i; done

ls /tmp
>1  2  3  4  5

BTpoolStop test
BTpoolRemove test

How it works ?

BT.sh needs one file for any pool and juste modify this file to control the pool. (Default folder : /dev/shm)

Contribution

All contribution are welcome.

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.