доработка остановки сервера, добавлен проход запроса активности сервера, перед созданием файла interrupt
This commit is contained in:
@@ -1,18 +1,59 @@
|
||||
package Visual_DVM_2021.Passes.SSH;
|
||||
import Common.Constants;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.Machine.Machine;
|
||||
import GlobalData.Machine.MachineType;
|
||||
import GlobalData.RemoteFile.RemoteFile;
|
||||
import GlobalData.User.User;
|
||||
|
||||
import java.util.Date;
|
||||
public class TestingServerSSHPass extends ConnectionPass {
|
||||
protected RemoteFile userHome;
|
||||
protected RemoteFile testingHome;
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void Connect() throws Exception {
|
||||
userHome =null;
|
||||
testingHome =null;
|
||||
//--
|
||||
machine = new Machine("alex", Global.properties.ServerAddress,Global.properties.ServerUserSHHPort,MachineType.Server);
|
||||
user = new User(Global.properties.ServerUserName, "mprit_2011");
|
||||
super.Connect();
|
||||
//--
|
||||
userHome = new RemoteFile(user.connection.sftpChannel.getHome(), true);
|
||||
testingHome = new RemoteFile(userHome, Constants.testingSystemHomeName);
|
||||
//-
|
||||
System.out.println("userHome="+ Utils.Brackets(userHome.full_name));
|
||||
System.out.println("testingHome="+Utils.Brackets(testingHome.full_name));
|
||||
}
|
||||
//--
|
||||
protected void Shutdown() throws Exception{
|
||||
//--
|
||||
RemoteFile INTERRUPT = new RemoteFile(testingHome, Constants.INTERRUPT);
|
||||
RemoteFile ABORTED = new RemoteFile(testingHome, Constants.ABORTED);
|
||||
//--
|
||||
ShowMessage1("Создание файла INTERRUPT..");
|
||||
user.connection.writeToFile("+", INTERRUPT);
|
||||
ShowMessage1("Ожидание остановки сервера тестирования");
|
||||
do {
|
||||
Utils.sleep(1000);
|
||||
ShowMessage2("Проверка признака остановки..");
|
||||
} while (!user.connection.Exists(ABORTED));
|
||||
//--
|
||||
ShowMessage2("");
|
||||
ShowMessage1("Журнализация");
|
||||
RemoteFile AbortLog = new RemoteFile(testingHome, Constants.ABORTED+
|
||||
"_by_"+
|
||||
Current.getAccount().email+
|
||||
"_"+
|
||||
new Date().toString()
|
||||
);
|
||||
user.connection.sftpChannel.rename(ABORTED.full_name, AbortLog.full_name);
|
||||
System.out.println("Done");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user