Also backup journal files
This commit is contained in:
1 parent
7ac0b02da3
commit
92926fb7ed
1 file changed
+7
-4
@@ -67,9 +67,10 @@ def runCouchPotato(options, base_path, args, data_dir = None, log_dir = None, En
|
|||||||
|
|
||||||
# Create path and copy
|
# Create path and copy
|
||||||
if not os.path.isdir(new_backup): os.makedirs(new_backup)
|
if not os.path.isdir(new_backup): os.makedirs(new_backup)
|
||||||
src_files = [options.config_file, db_path]
|
src_files = [options.config_file, db_path, db_path + '-shm', db_path + '-wal']
|
||||||
for src_file in src_files:
|
for src_file in src_files:
|
||||||
shutil.copy2(src_file, os.path.join(new_backup, os.path.basename(src_file)))
|
if os.path.isfile(src_file):
|
||||||
|
shutil.copy2(src_file, os.path.join(new_backup, os.path.basename(src_file)))
|
||||||
|
|
||||||
# Remove older backups, keep backups 3 days or at least 3
|
# Remove older backups, keep backups 3 days or at least 3
|
||||||
backups = []
|
backups = []
|
||||||
@@ -81,9 +82,11 @@ def runCouchPotato(options, base_path, args, data_dir = None, log_dir = None, En
|
|||||||
total_backups = len(backups)
|
total_backups = len(backups)
|
||||||
for backup in backups:
|
for backup in backups:
|
||||||
if total_backups > 3:
|
if total_backups > 3:
|
||||||
if int(os.path.basename(directory)) < time.time() - 259200:
|
if int(os.path.basename(backup)) < time.time() - 259200:
|
||||||
for src_file in src_files:
|
for src_file in src_files:
|
||||||
os.remove(os.path.join(backup, os.path.basename(src_file)))
|
b_file = os.path.join(backup, os.path.basename(src_file))
|
||||||
|
if os.path.isfile(b_file):
|
||||||
|
os.remove(b_file)
|
||||||
os.rmdir(backup)
|
os.rmdir(backup)
|
||||||
total_backups -= 1
|
total_backups -= 1
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user