diff options
| author | 2019-12-06 17:07:25 +0000 | |
|---|---|---|
| committer | 2019-12-06 17:07:25 +0000 | |
| commit | 9664e275f4fc0134fb35aa8252cef32eb0b1e494 (patch) | |
| tree | 51b20e7a5340183c4e303f692ab95c1ea1e35532 /modules/database_backup.py | |
| parent | "qoute" -> "quote" typo (diff) | |
| signature | ||
remove database_backup.py, add note in README.md about what should be backed up
Diffstat (limited to 'modules/database_backup.py')
| -rw-r--r-- | modules/database_backup.py | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/modules/database_backup.py b/modules/database_backup.py deleted file mode 100644 index cd9a01c9..00000000 --- a/modules/database_backup.py +++ /dev/null @@ -1,29 +0,0 @@ -import datetime, glob, os, shutil, time -from src import ModuleManager, utils - -BACKUP_INTERVAL = 60*60 # 1 hour -BACKUP_COUNT = 5 - -class Module(ModuleManager.BaseModule): - def on_load(self): - now = datetime.datetime.now() - until_next_hour = 60-now.second - until_next_hour += ((60-(now.minute+1))*60) - - self.timers.add("database-backup", self._backup, BACKUP_INTERVAL, - time.time()+until_next_hour) - - def _backup(self, timer): - location = self.bot.database.location - files = glob.glob("%s.*.back" % location) - files = sorted(files) - - while len(files) > 4: - os.remove(files[-1]) - files.pop(-1) - - suffix = datetime.datetime.now().strftime("%y-%m-%d.%H:%M:%S") - backup_file = "%s.%s.back" % (location, suffix) - shutil.copy2(location, backup_file) - - timer.redo() |
