Monday, May 28, 2012

JASSH (JAnalyseSSH) 0.8.0 released

JASSH is a high level scala SSH API for easy and fast operations on remote servers. ( ** project page **)

Latest changes :
  • now using sbt 0.11.3
  • now using sbt-assembly 0.8.1
  • now using sbteclipse 2.1.0-RC1
  • Set of new method to help with commons remote commands :
    fileSize, md5sum, sha1sum, uname, ls, pwd, cd(*), hostname, date, findAfterDate (*) of course only for shell sessions
  • JSCH updated to 0.1.48
  • md5sum method added to SSHTools object
  • manage well connect timeout (default = 30s) and general socket timeout (default = 5mn)

hello scala script

#!/bin/sh
exec java -jar jassh.jar -nocompdaemon -usejavacp -savecompiled "$0" "$@"
!#

print(jassh.SSH.shell("localhost", "test", "testtest") {_ execute "echo Hello `hostname`" } )
  
  

remote vmstat scala script

#!/bin/sh
exec java -jar jassh.jar -nocompdaemon -usejavacp -savecompiled "$0" "$@"
!#

jassh.SSH.once("localhost", "test", "testtest")  {
  _.run("vmstat 1 10", println(_.getOrElse("")).waitForEnd
}

smallest script : print remote system name (uname)

#!/bin/sh
exec java -jar jassh.jar -nocompdaemon -usejavacp -savecompiled "$0" "$@"
!#

println(jassh.SSH.shell("localhost", "test", "testtest") { _.uname})
 

No comments:

Post a Comment