【笔记】【Informatica】Java组件调用ssh客户端远程执行linux系统上的shell脚本
Process mypro=null; try{ String cmdStr="C:\\SSH\\ssh2.exe azik@172.16.20.1 /home/azik/tmp/echo_date.sh"; mypro=Runtime.getRuntime().exec(cmdStr); mypro.waitFor(); Integer errno=mypro.exitValue(); logInfo("The errorlevel is :"+errno); if (errno != 0) { logError("Execute Cmd Fail."); failSession("Catch Exception!"); } } catch(Exception e) { logError(e.toString()); failSession("Catch Exception!"); } finally { if(mypro != null){ mypro.destroy(); } }