Administrator
2021-01-19 fbed4c7738db69c0d6a30c10f6944268ba28ea9e
BattMonitor_FBS9100S_DataBaseBackUp/src/com/backup/DataBaseBackUpThread.java
@@ -10,6 +10,7 @@
import java.util.regex.Pattern;
import com.base.Com;
import com.config.AppConfig;
import com.sql.MysqlConnPool;
import main.main_FBS9100S_DataBaseBackUp;
@@ -24,9 +25,12 @@
   private MysqlConnPool pool;
   private String savePath = System.getProperty("user.dir")+ File.separator+"mysql_backup";         //备份数据库的根目录
   private MyRunTime runtime = null;
   private AppConfig appcfg;
   
   public DataBaseBackUpThread(MysqlConnPool conn_pool){
   public DataBaseBackUpThread(MysqlConnPool conn_pool,AppConfig appcfg){
      this.pool = conn_pool;
      this.appcfg = appcfg;
      this.runtime = new MyRunTime(this.pool);
      
      DataBaseBackUpThread_SQL.createBackupTable(pool);                                              //初始化数据库表
@@ -55,7 +59,7 @@
            //System.out.println();
            
            //12点59分开始备份所有的数据库
            if(countTimeLong(nowTime, normTime)<30 && countTimeLong(lastRecodTime, nowTime) >= 7*24*60*60) {
            if(countTimeLong(nowTime, normTime)<30 || countTimeLong(lastRecodTime, nowTime) >= 7*24*60*60) {
               System.out.println("开始备份所有的数据库"+Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
               this.list = DataBaseBackUpThread_SQL.searchAllDataBaseAndTable(pool);
               String path = savePath+File.separator+REGULAR_BACKUP_PATHNAME;
@@ -78,7 +82,7 @@
               File zipFile = zipUtil.createZip(zipName, new File(path));   //压缩数据库文件
               
               
               HzipSocket SocketClient = new HzipSocket();
               HzipSocket SocketClient = new HzipSocket(appcfg);
               SocketClient.init(zipName);                     //发送数据库备份文件到远程服务器
               System.out.println("远程备份数据库完成" + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
               if(zipFile.exists() && zipFile.length() > 1*1024 && new File(path).exists()) {