2023-11-19 02:12:44 +03:00
|
|
|
package Visual_DVM_2021.Passes.All;
|
2024-01-08 20:37:16 +03:00
|
|
|
import Common.Utils.Utils;
|
|
|
|
|
import GlobalData.RemoteFile.RemoteFile;
|
2023-11-19 02:12:44 +03:00
|
|
|
import Visual_DVM_2021.Passes.SSH.CurrentConnectionPass;
|
2023-09-17 22:13:42 +03:00
|
|
|
public class RemoteSingleCommand extends CurrentConnectionPass<String> {
|
|
|
|
|
String command = "";
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean canStart(Object... args) {
|
|
|
|
|
if (super.canStart(args)) {
|
|
|
|
|
command = (String) args[0];
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void ServerAction() throws Exception {
|
2024-01-08 20:37:16 +03:00
|
|
|
RemoteFile file = new RemoteFile(user.connection.sftpChannel.getHome(), Utils.getDateName("out"));
|
|
|
|
|
user.connection.ShellCommand(command+" 1>"+Utils.DQuotes(file.full_name));
|
|
|
|
|
if (user.connection.Exists(file)){
|
|
|
|
|
target = user.connection.readFromFile(file);
|
|
|
|
|
}
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
}
|