This commit is contained in:
2024-03-24 02:49:32 +03:00
parent 784bca869d
commit e83ecac005
9 changed files with 119 additions and 43 deletions

View File

@@ -10,6 +10,11 @@ import GlobalData.User.User;
import java.util.Date;
public class TestingServerSSHPass extends ConnectionPass {
@Override
public String getButtonText() {
return "";
}
//--
protected RemoteFile userHome;
protected RemoteFile testingHome;
@Override
@@ -18,23 +23,43 @@ public class TestingServerSSHPass extends ConnectionPass {
}
@Override
public void Connect() throws Exception {
userHome =null;
testingHome =null;
userHome = null;
testingHome = null;
//--
machine = new Machine("alex", Global.properties.ServerAddress,Global.properties.ServerUserSHHPort,MachineType.Server);
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));
System.out.println("userHome=" + Utils.Brackets(userHome.full_name));
System.out.println("testingHome=" + Utils.Brackets(testingHome.full_name));
}
//--
protected void Shutdown() throws Exception{
protected void StartServer() throws Exception {
user.connection.performScript(testingHome, "nohup java -jar TestingSystem.jar &");
RemoteFile StartLog = new RemoteFile(testingHome, Constants.STARTED +
"_by_" +
Current.getAccount().email +
"_" +
new Date().toString()
);
user.connection.writeToFile("+", StartLog);
//--
RemoteFile INTERRUPT = new RemoteFile(testingHome, Constants.INTERRUPT);
RemoteFile[] files = new RemoteFile[]{
new RemoteFile(testingHome, Constants.script),
new RemoteFile(testingHome, Constants.out_file),
new RemoteFile(testingHome, Constants.err_file)
};
//-
for (RemoteFile file : files) {
user.connection.tryRM(file);
}
}
protected void ShutdownServer() throws Exception {
//--
RemoteFile INTERRUPT = new RemoteFile(testingHome, Constants.INTERRUPT);
RemoteFile ABORTED = new RemoteFile(testingHome, Constants.ABORTED);
//--
ShowMessage1("Создание файла INTERRUPT..");
@@ -47,10 +72,10 @@ public class TestingServerSSHPass extends ConnectionPass {
//--
ShowMessage2("");
ShowMessage1("Журнализация");
RemoteFile AbortLog = new RemoteFile(testingHome, Constants.ABORTED+
"_by_"+
Current.getAccount().email+
"_"+
RemoteFile AbortLog = new RemoteFile(testingHome, Constants.ABORTED +
"_by_" +
Current.getAccount().email +
"_" +
new Date().toString()
);
user.connection.sftpChannel.rename(ABORTED.full_name, AbortLog.full_name);