[英]Running commands in remote linux from java
I want to do a remote shell to a Linux system and run various commands eg to ps
and grep
for processes and kill them. 我想对Linux系统做一个远程shell,并运行各种命令,例如对ps
和grep
进行处理并杀死它们。
I assume I can do something like: rsh
that linux scripts do right?Is this the best option for me? 我想我可以做些类似的事情: rsh
linux脚本正确吗?这对我来说是最佳选择吗?
rsh
is unencrypted so isn't widely used anymore and is probably switched off on the remote systems you want to connect to. rsh
是未加密的,因此不再被广泛使用,并且可能已在您要连接的远程系统上关闭。
It would be better to use SSH
. 最好使用SSH
。 JSch is a open source pure Java library that will make SSH connections and run commands for you. JSch是一个开放源代码的纯Java库 ,它将建立SSH连接并为您运行命令。
JSch是执行此类任务的不错选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.