API for control.core - control


Full namespace name: control.core

Overview





Public Variables and Functions



call

function
Usage: (call task & args)
Call other tasks in deftask,for example:
(call :ps "java")


clear-options!

function
Usage: (clear-options!)
Clear global options


defcluster

macro
Usage: (defcluster cname & args)
Define a cluster including some remote machines,for example:
      (defcluster :mycluster
                :user "login"
                :addresses ["a.domain.com" "b.domain.com"])

 Please see https://github.com/killme2008/clojure-control/wiki/Define-clusters
Added in control version 0.1


deftask

macro
Usage: (deftask tname & decl)
Define a task for executing on remote machines:
 (deftask :date "Get date from remote machines"
           (ssh "date"))

Please see https://github.com/killme2008/clojure-control/wiki/Define-tasks
Added in control version 0.1


exists?

function
Usage: (exists? file)
Check if a file or directory is exists


local

function
Usage: (local cmd)
Execute command on local machine


rsync

function
Usage: (rsync src dst & opts)
Rsync local files to remote machine's files,for example:
   (deftask :deploy "scp files to remote machines" []
  (rsync "src/" ":/home/login"))

  Valid options:
  :rsync-options  -- rsync options string


scp

function
Usage: (scp local remote & opts)
Copy local files to remote machines:
 (scp "test.txt" "remote.txt")
 (scp ["1.txt" "2.txt"] "/home/deploy/" :sudo true :mode 755)

Valid options:
  :sudo  -- whether to copy files to remote machines as root
  :mode -- files permission on remote machines
  :scp-options -- scp options string


set-options!

function
Usage: (set-options! key value & kvs)
Set global options for ssh,scp and rsync,
 key and value  could be:

    Key                               Value
:ssh-options        a ssh options string,for example "-o ConnectTimeout=3000"
:scp-options       a scp options string
:rsync-options    a rsync options string.
:user                    global user for cluster,if cluster do not have :user ,it will use this by default.
:parallel               if to execute task on remote machines in parallel,default is false
:error-mode      mode-keyword,:exit (exit when error happends,the default error mode). or :exception (throw an exception).

Example:
      (set-options! :ssh-options "-o ConnectTimeout=3000")



ssh

function
Usage: (ssh cmd & opts)
Execute commands via ssh:
(ssh "date")
(ssh "ps aux|grep java")
(ssh "sudo apt-get update" :sudo true)

Valid options:
:sudo   whether to run commands as root,default is false
:ssh-options  -- ssh options string
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.