Skip to content

Getting started

killme2008 edited this page Jul 18, 2012 · 14 revisions

Clojure-Control bootstraps itself using the control shell script; there is no separate install script. It installs its dependencies upon the first run on unix, so the first run will take longer.

  • Download the script.
  • Place it on your $PATH. (I like to use ~/bin)
  • Set it to be executable. (chmod 755 ~/bin/control)

The link above will get you the stable release.

On Windows most users can get the batch file. If you have wget.exe or curl.exe already installed and in PATH, you can just run control self-install, otherwise get the standalone jar from the downloads page. If you have Cygwin you should be able to use the shell script above rather than the batch file.

Creating a control file by:

 control init

It will create a file named control.clj under mycontrol folder.Defines your clusters and tasks in this file,for example:

 (defcluster :default-cluster
     :clients [
              {:host "localhost" :user "root"}
     ])
 (deftask :date "echo date on cluster"  []
     (ssh "date"))

It defines a cluster named default-cluster,and defines a task named date to execute date command on remote machines.Run date task on default-cluster by:

control run default-cluster date

Output:

Performing default-cluster
Performing date for localhost
localhost:ssh:  date
localhost:stdout: Sun Jul 24 19:14:09 CST 2011
localhost:exit: 0

Except defining a cluster,you can just run a task with user@host(since 0.3.6):

control run deploy@app.com date

You may have to type password when running this task. You can setup ssh public keys to avoid typing a password when logining remote machines.please visit HOWTO: set up ssh keys

More commands please see Command lines

#Next

You may want to learn how to define clusters and tasks. After that,you must learn more DSL commands for defining tasks.

Clone this wiki locally