[英]Java - JSch - Getting exit status 123. What does it mean?
Running command to retrieve a data from files on remote server (code bellow).运行命令从远程服务器上的文件中检索数据(代码如下)。 On closing channel sometimes receiving exit code 123.在关闭频道时,有时会收到退出代码 123。
Found in https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx在https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx 中找到
ERROR_INVALID_NAME 123 (0x7B) The filename, directory name, or volume label syntax is incorrect. ERROR_INVALID_NAME 123 (0x7B) 文件名、目录名或卷标语法不正确。
But I am not sure it is the same error code meaning.但我不确定它是否是相同的错误代码含义。 Please, advise请指教
Code:代码:
JSch jsch = new JSch();
java.util.Properties config = new java.util.Properties();
config.put("StrictHostKeyChecking", "no");
session = jsch.getSession(BillingUser, BillingHost, 22);
session.setPassword(BillingPassword);
session.setConfig(config);
session.connect();
channel = session.openChannel("exec");
((ChannelExec) channel).setCommand(command);
channel.setInputStream(null);
(ChannelExec) channel).setErrStream(System.out);
InputStream inputStream = channel.getInputStream();
InputStream errStream = channel.getExtInputStream();
channel.connect();
if (inputStream.available() > 0) {
//saving output here
}
inputStream.close();
errStream.close();
if (channel.isClosed()) {
if (channel.getExitStatus() != 0){
//printing here exitStatus value
}
}
Connecting to Linux.连接到 Linux。 Running command like:运行命令如:
find filesPath -type f -name "meAutomation,meAutomation*"| xargs egrep -r -i "20171031(04|03).*,meAutomation,meAutomation,.*,mEnterprise.*"
The exit code is system specific.退出代码是系统特定的。
You are probably connecting to *nix system.您可能正在连接到 *nix 系统。 So you may want to read answers to所以你可能想阅读答案
Got exit code 123 in find + xargs grep .在 find + xargs grep 中得到退出代码 123 。
123 means "any invocation exited with a non-zero status". 123 表示“任何以非零状态退出的调用”。
Obligatory warning: Do not use StrictHostKeyChecking=no
to blindly accept all host keys.强制性警告:不要使用StrictHostKeyChecking=no
盲目接受所有主机密钥。 That is a security flaw.这是一个安全漏洞。 You lose a protection against MITM attacks .你失去了对MITM 攻击的保护。 For the correct (and secure) approach, see: How to resolve Java UnknownHostKey, while using JSch SFTP library?有关正确(且安全)的方法,请参阅:如何在使用 JSch SFTP 库时解析 Java UnknownHostKey?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.