Наметил локальный вариант, но пока не уверен что он приоритетен..

This commit is contained in:
2024-04-27 18:44:36 +03:00
parent c84a648bb6
commit 002a8517e0
14 changed files with 421 additions and 292 deletions

View File

@@ -468,11 +468,10 @@ public class UserConnection {
}
public void waitForFileCreation(RemoteFile file) throws Exception {
while (!Exists(file)){
System.out.println(file.name +" NOT FOUND");
System.out.println(file.full_name +" NOT FOUND");
Utils.sleep(1000);
}
}
//возможно в дальнейшем обобщить чтобы вместо PID был файл вывода с задаваемым именем?
public String startShellProcess(RemoteFile directory, String outFileName, String... commands) throws Exception {
Vector<String> commands_ = new Vector<>();
commands_.add("cd " + Utils.DQuotes(directory.full_name));
@@ -490,8 +489,11 @@ public class UserConnection {
String start_command = Utils.DQuotes(script_file.full_name);
//--
RemoteFile outFile = new RemoteFile(directory, outFileName);
if (Exists(outFile))
sftpChannel.rm(outFile.full_name);
ShellConnect();
pin.write(("nohup " + start_command + " &\r\n").getBytes());
waitForFileCreation(outFile);
ShellDisconnect();
return readFromFile(outFile).replace("\n","").replace("\r","");