A leiningen plugin that generates *NIX daemon scripts.
HTML Clojure Shell
Switch branches/tags
Nothing to show
Pull request Compare This branch is 36 commits ahead of zk:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



A leiningen plugin that generates *NIX init scripts.

In a nutshell, LIS generates the following artifacts which can be found in your /init-script dir:

  • Project Uberjar

  • d script

    Paired down from the Fedora Core init script template, injected with values from your lein project.clj.

  • install- script

    Creates (but does not overwrite) the :pid-dir, :install-dir, and :init-script-install-dir directories. To override the defaults see the Configuration section below.

  • clean- script

    Removes the init script, and uberjar from their respective install paths. Does not remove any created directories.

If you have an feature suggestions / bug reports, please open up an issue


Because it was too damn time-consuming to turn a java program into a *nix daemon service that can be started / stopped asyncronously, chkconfig'd, etc.


For Leiningen v1.x, add [org.clojars.strongh/lein-init-script "1.3.1"] to the :dev-dependencies section in your project.clj.

With Leiningen v2, add [org.clojars.strongh/lein-init-script "1.3.1"] to your user plugins.


lein-init-script takes several options in the form of:

{:name "override-project-name"
 :pid-dir "/var/run"
 :install-dir "/usr/local/my-project-name"
 :init-script-install-dir "/etc/init.d"
 :redirect-output-to "/log/file"
 :properties {:clj-config.env "dev"
			  :java.library.path "/some/dir"
			  :init.script.test.prop "prop with spaces"}
 :jar-args ["-p" "8080"]
 :jvm-opts ["-server"

which are passed to the the init-script task by adding a :lis-opts entry to the project map. For example:

(defproject init-script-test "0.1.0"
  :description "Test project for lein-init-script"
  :dependencies [[org.clojure/clojure "1.1.0"]
                 [org.clojure/clojure-contrib "1.1.0"]]
  :dev-dependencies [[org.clojars.strongh/lein-init-script "1.3.1"]]
  :lis-opts {:redirect-output-to "/var/log/init-script-test.log"
             :properties {:clj-config.env "dev"
			  			  :java.library.path "/some/dir"
			  			  :init.script.test.prop "prop with spaces"}
	         :jvm-opts ["-server"
  :main main)


Create a main class for your project, run lein init-script, and check the ./init-script directory. Typically you'll want to run ./init-script/install-project and then restart with e.g. /etc/init.d/projectd restart.

ring uberjar and others

If you're using ring uberjar you can disable running vanilla uberjar by init-script. To do this set :run-uberjar? to false and run arbitrary xxx uberjar before calling init-script. To do it in one like use do task:

lein do ring uberjar, init-script


No Windows support at this time, if you'd like to see support for windows services, please open up an issue.


Eclipse Public License v1.0