【笔记】【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();
    }
}

  

原文地址:https://www.cnblogs.com/AzikPhil/p/Informatica_Java_SSH.html