Giter Site home page Giter Site logo

clidispatcher's Introduction

CliDispatcher

A generic multithreaded Command Line Interface dispatcher. It fetches one or more queues (Beanstalkd or SQS) for a message and dispatch it as a shell command.

System requirements:

  • jsvc(*)
  • java7 (openjdk-7-jdk for devs, openjdk-7-jre for everybody)
  • maven (dev only)
  • git (likely)
  • beanstalkd or SQS

(*) If you want to specify the current working directory inside the jsvc_exec(), using the parameter -cwd, you need to use the latest jsvc version.

Source dependencies are automatically resolved through Maven

Step-by-step compilation:

  • sudo apt-get install openjdk-7-jdk jsvc maven git beanstalkd (install requirements with your favorite pkg manager)
  • Download source from github or directly clone the repository
  • Copy files in src/main/resources in the same folder, renaming them without the .dist suffix
  • Customize these new .properties files
  • Once you are in the project folder, run mvn clean install
  • Two jars should have been generated in the target folder

Step-by-step installation:

  • Customize the ./clidispatcher file (check at least the JAVA_HOME and the USER because most probably you don't want to run every command as the root user)
  • sudo cp ./clidispatcher /etc/init.d/clidispatcher (copy the upstart script into the proper folder)
  • sudo chmod 755 /etc/init.d/clidispatcher (gives execution and read rights to everybody)
  • sudo mkdir -p /usr/local/clidispatcher/lib (creates the default FILE_PATH directory as well as the lib directory (you'll need it later))
  • sudo cp ./target/BeanstalkdUtils-0.1-jar-with-dependencies.jar /usr/local/clidispatcher/clidispatcher.jar (take the jar with dependencies, copy it in the FILE_PATH directory (default shown here)) and rename it as clidispatcher.jar)
  • Open the clidispatcher.jar with a zip editor, rename files in *.properties.dist removing the .dist suffix and customize them
  • sudo wget -O /usr/local/clidispatcher/lib/commons-daemon-1.0.15.jar https://www.apache.org/dist/commons/daemon/binaries/commons-daemon-1.0.15.jar (get the commons-daemon library and puts it into the right folder)
  • sudo chown -R user:root /usr/local/clidispatcher (give the root and the USER user (as specified in the clidispatcher upstart file) ownership rights for the FILE_PATH directory)
  • sudo chmod -R 770 /usr/local/clidispatcher (give them all rights)
  • sudo update-rc.d clidispatcher defaults (generate default rc.d scripts)
  • sudo service clidispatcher start (start the service)
  • Enjoy!

Notes:

  • At the moment the maximum waiting time for stop is statically bound at 60 seconds
  • If you get a "unknown parameter -cwd" error, check for the IMPORTANT NOTE in the clidispatcher upstart file

clidispatcher's People

Contributors

emanuelecasadio avatar

Stargazers

coder avatar

Watchers

James Cloos avatar coder avatar  avatar

clidispatcher's Issues

Cercare di usare /bin/bash

Al momento viene invocato direttamente l'eseguibile con i suoi parametri, passando al di fuori dalla console.

Per avere un funzionamento più ricco, si potrebbe provare a usare la console di sistema tramite /bin/bash -c <bash_input>.

Il problema è che quando viene passato un comando con più di un parametro (ad esempio /bin/bash -c "echo foo" restituisce File not found perché penso che bash vada a cercare il binario echo\ foo).

Valutare se rendere open-source

Avrei intenzione di rendere open-source il presente codice.

Stabilire:

  • fattibilità;
  • il repo padre (a me piacerebbe emanuelecasadio/ per avere finalmente qualcosa di carino da mostrare al mondo sul mio profilo GitHub, indicando però che il lavoro è sponsorizzato da Kopjra, e mantenendo Kopjra nei namespace).

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.