Files
VisualSapfor/src/Visual_DVM_2021/Passes/All/RemoteSingleCommand.java
2024-10-07 22:22:51 +03:00

25 lines
914 B
Java

package Visual_DVM_2021.Passes.All;
import Common.Utils.CommonUtils;
import GlobalData.RemoteFile.RemoteFile;
import Visual_DVM_2021.Passes.SSH.CurrentConnectionPass;
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 {
RemoteFile file = new RemoteFile(user.connection.sftpChannel.getHome(), CommonUtils.getDateName("out"));
user.connection.Command(command + " 1>" + CommonUtils.DQuotes(file.full_name));
if (user.connection.Exists(file)) {
target = user.connection.readFromFile(file);
user.connection.sftpChannel.rm(file.full_name);
}
}
}