庄周梦蝶

生活、程序、未来
   :: 首页 ::  ::  :: 聚合  :: 管理

Clojure-Control 0.3.0 is out

Posted on 2012-02-18 22:08 dennis 阅读(3430) 评论(0)  编辑  收藏 所属分类: my open-sourceClojure
    Clojure-control is a clojure DSL for system admin and deployment with many remote machines via ssh. 
    
    I am pleased to annoucment that clojure-control 0.3.0 is out.It adds some  powerful features in this release ,includes:
  • ssh and scp both have a new option :sudo  to be executed as root on remote machines,for example:
    (ssh "/etc/init.d/ssh restart" :sudo true)
  • scp has a new  option :mode to change file modes copied from local: 
    (scp "start.sh" "/etc/init.d/start.sh" :sudo true :mode 755)
  • A  new function "exists?" to test if a file exists on remote machines:  
    (if (not (exists? (str "/home/deploy/.ssh")))
          (ssh (sudo (str "mkdir -p /home/deploy/.ssh"))))
  • Call other task in deftask with "call" function:
    (deftask :ps "A task to grep process" [process]
            (ssh (str "ps aux | grep " process)))
    (deftask :start_ha []
            (ssh "/etc/init.d/haproxy start")
            (call :ps "haproxy"))
  • A new function "append" to append a line to a file on remote machines:
    (ssh (append "/etc/hosts" "192.168.1.100 web" :sudo true))
  • A new function "sed" to replace lines in a file on remote machines,and comm/uncomm to comment/uncomment a line in a file:
          (sed <file> <before> <after> :flags <flags> :limit <limit> :backup <backup>)
    

    Equivalent to

          sed -i<backup> -r -e "<limit> s/<before>/<after>/<flags>g <filename>"
  • Limits max output line to 10000.
  • Adds more documents in wiki: https://github.com/killme2008/clojure-control/wiki 
   You can install the new version by :
    lein plugin install control 0.3.0           #For clojure 1.3
    lein plugin install control 0.3.1           #For clojure 1.2

    More information please visit it on github: https://github.com/killme2008/clojure-control

只有注册用户登录后才能发表评论。


网站导航: