public DatabaseDumpTest() { _backupPath = @"C:\Data\Backup\MySQL\"; _backupPathTemp = @"C:\Data\Backup\MySQL\Temp\"; _database = "my_test_db"; _createPath = new CreatePath(); _clearPath = new ClearPath(); _databaseDump = new DatabaseDump() { BackupPath = _backupPath, DbPassword = "******", DbUser = "******", DumpFileStamp = DateTime.Now, MySqlServerPath = @"C:\Program Files\MySQL\MySQL Server 5.7\bin" }; _createPath.Go(_backupPath); _createPath.Go(_backupPathTemp); _clearPath.Go(_backupPathTemp); }
public void Go() { _logger.Log("BackupDatabase START"); _createPath.Go(_backupPath); _createPath.Go(_backupPathTemp); _clearPath.Go(_backupPathTemp); foreach (var database in _dbList) { try { if (_databaseDump.Go(database)) { var dumpFile = _databaseDump.ResultDumpFile; //20180818_DBNAME.sql if (_zipAndMove.Go(dumpFile)) { _purgeLocal.Go(); _ftpCreateRemotePath.Go(); _ftpSendFileToRemote.Go(_zipAndMove.NewFileName); } var yearFolderList = _ftpListDirectoryOnRemote.Go(true, _remoteBasePath); _ftpPurgeRemoteData.Go(yearFolderList); } else { _logger.Log(_databaseDump.Error); } } catch (Exception ex) { _logger.Log(ex); } } _logger.Log("BackupDatabase FINISH"); }