- Timestamp:
- Oct 24, 2019, 1:19:12 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ipp-259_genericise_backups/tools/backups/backup.py
r40962 r40966 115 115 116 116 def run_backup_processes(self): 117 117 self._write_begin_log() 118 118 if self.should_run_copy: 119 119 self._run_copy() … … 124 124 if self.should_run_mysqldump: 125 125 self._run_mysqldump() 126 self._write_end_log() 126 127 127 128 def hostname_is_valid(self) -> bool: … … 260 261 return 0 261 262 263 def _write_begin_log(self): 264 backup_paths = self.default_dict["backup_paths"] 265 for bp in backup_paths: 266 log_file = path.join(bp, "latest_run.log") 267 if path.exists(log_file): 268 os.remove(log_file) 269 with open(log_file, "w+") as lf: 270 lf.write(f'Run started at: {datetime.date.today().strftime("%Y_%b_%d_%H:%M")}\n') 271 272 def _write_end_log(self): 273 backup_paths = self.default_dict["backup_paths"] 274 for bp in backup_paths: 275 log_file = path.join(bp, "latest_run.log") 276 if not path.exists(log_file): 277 return 278 with open(log_file, "a") as lf: 279 lf.write(f'Last successful backup completed at : {datetime.date.today().strftime("%Y_%b_%d_%H:%M")}\n') 280 262 281 263 282 def get_date(custom_date=None, custom_format="%Y_%m_%d"):
Note:
See TracChangeset
for help on using the changeset viewer.
