exec : shell(11) : java调用shell_Lxinccode的博客-CSDN博客_shell11
import static com.alibaba.gts.ai.deploy.ocrzxx.util.ShellUtil.exec;
public class RemoteExec {
private String ip;
private Integer port;
private String username;
public RemoteExec() {
}
public String run(String command) {
return exec("ssh -p " + port + " " + username + "@" + ip + " "" + command + """);
}
public RemoteExec(String ip, Integer port, String username) {
this.ip = ip;
this.port = port;
this.username = username;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}


![shell(35) : java执行远程shell[2] shell(35) : java执行远程shell[2]](http://www.mshxw.com/aiimages/31/995963.png)
