无法从 Java 代码向服务器发送命令
我无法向服务器发送命令。但是,连接已建立,我可以执行“rm /usr/testfile”等简单操作。当我尝试执行“tail -f /opt/logs/applications/db/cbss.log >> cbsslog_tailed”之类的命令时。请帮我通过java代码执行tail命令。
I am not able to send commands to the server. However the connection is established and I am able to do the simple operations like "rm /usr/testfile". When I try to execute the command like "tail -f /opt/logs/applications/db/cbss.log >> cbsslog_tailed". Please help me to execute the tail command through java code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您想通过从服务器运行的 Java shell 命令执行支持在 Linux 中进行 I/O 重定向。如何解决重定向问题请参考以下链接:
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=4
上面链接中的示例程序是在Windows环境下使用的。但是,我认为它可以毫无问题地移植到 Linux 上。
It looks like you want to do I/O redirection in Linux via Java shell command execution support running from a server. Please refer to the link below on how to solve redirection problem:
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=4
The sample programs in the link above are used in Windows environment. But, I think it could be ported to Linux without any problem.