смена имен бд тестов на актуальные. удаление старых при запуске

This commit is contained in:
2023-11-14 20:08:19 +03:00
parent 9c5414f477
commit c1c56621c2
9 changed files with 49 additions and 20 deletions

View File

@@ -25,16 +25,6 @@ import java.io.File;
import java.nio.file.Paths;
import java.util.Vector;
public class Global {
//пробный коммит. изменение комментария.++
//кронтаб и перезагрузка
//https://snipp.ru/raznoe/crontab
// /var/spool/cron/crontabs/testuser что менять
//https://saribzhanov.ru/tehno/perezagruzka-ubuntu-po-cron/ //раз в сутки
//testuser ALL=NOPASSWD:/sbin/reboot
//0 2 2,15 * * reboot &>/var/log/reboot.log
//https://unix.stackexchange.com/questions/117148/how-can-i-run-reboot-as-a-normal-user-without-needing-to-enter-a-password
public static final String ServerAddress = "alex-freenas.ddns.net";
public static final String dateNaN = "NaN";
//--------------------------------------------------
//текущая папка системы. в отличие от шарпа никогда не должна меняться.
public static final String components = "Components";
@@ -248,8 +238,25 @@ public class Global {
return String.join("|", res_);
}
//--
public static void removeOldDatabases() {
File data = Paths.get(System.getProperty("user.dir"), "Data").toFile();
File[] files = data.listFiles();
if (files != null) {
for (File file : files) {
if (file.getName().contains(Constants.old_tests_db_name)) {
System.out.println("found "+Utils.Brackets(file.getAbsolutePath()));
try {
Utils.forceDeleteWithCheck(file);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
}
}
public static void NormalMode(int port) throws Exception {
isWindows = System.getProperty("os.name").startsWith("Windows");
removeOldDatabases();
CheckVisualiserDirectories();
CreateLog();
//-