Наметил локальный вариант, но пока не уверен что он приоритетен..
This commit is contained in:
@@ -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","");
|
||||
|
||||
Reference in New Issue
Block a user