Create db backup dir before trying to use it. fix #2207
This commit is contained in:
@@ -83,6 +83,7 @@ def runCouchPotato(options, base_path, args, data_dir = None, log_dir = None, En
|
||||
|
||||
# Backup before start and cleanup old databases
|
||||
new_backup = toUnicode(os.path.join(data_dir, 'db_backup', str(int(time.time()))))
|
||||
if not os.path.isdir(new_backup): os.makedirs(new_backup)
|
||||
|
||||
# Remove older backups, keep backups 3 days or at least 3
|
||||
backups = []
|
||||
@@ -94,7 +95,6 @@ def runCouchPotato(options, base_path, args, data_dir = None, log_dir = None, En
|
||||
latest_backup = tryInt(os.path.basename(sorted(backups)[-1])) if len(backups) > 0 else 0
|
||||
if latest_backup < time.time() - 3600:
|
||||
# Create path and copy
|
||||
if not os.path.isdir(new_backup): os.makedirs(new_backup)
|
||||
src_files = [options.config_file, db_path, db_path + '-shm', db_path + '-wal']
|
||||
for src_file in src_files:
|
||||
if os.path.isfile(src_file):
|
||||
|
||||
Reference in New Issue
Block a user