Coder Social home page Coder Social logo

lein-daemon's Introduction

Lein-daemon is a lein plugin that starts a clojure process as a daemon. In version 0.3, it has been re-written to not depend on any 3rd party client code on the box.

To use, add a :daemon option to your project.clj, it looks like

    :daemon {:name-of-service {:ns my.name.space
                               :pidfile "path-to-pidfile.pid"}}

The keys of the daemon map are the names of services that can be started at the command-line. Start a process with "lein daemon start :name-of-service". pidfile specifies where the pid file will be written. This path can be relative to the project directory, or absolute.

Install

add lein-daemon to your leiningen project file, as a dev-dependency::

    :dev-dependencies [[lein-daemon "0.4.0"]]

lein-daemon requires JNA to load the C standard library, so if you're using an uncommon JVM, you might need to install JNA on your box. If you're running Hotspot, you're probably fine.

NS

Like lein run, lein daemon will call a function named -main, in the namespace specified by :ns. Any additional command line arguments will be passed to -main.

Operation

Lein daemon currently has three commands, start, stop, check. Start with lein daemon start :name-of-service. This will call the -main function in the specified ns, with no arguments. Extra arguments may also be specified, like lein daemon start :service foo bar baz.

Stop the process with lein daemon stop name-of-service. Daemon will use the pid file to identify which process to stop.

Check if the process is still running with lein daemon check name-of-service.

lein-daemon's People

Contributors

arohner avatar gregsexton avatar

Stargazers

Niko Maroulis avatar

Watchers

Niko Maroulis avatar 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.