From 96291f63da15ed571bb8385a25ba325eae443be2 Mon Sep 17 00:00:00 2001 From: Ruud Date: Thu, 19 Sep 2013 22:11:10 +0200 Subject: [PATCH] Create db backup dir before trying to use it. fix #2207 --- couchpotato/runner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/runner.py b/couchpotato/runner.py index 7403a54f..571023ea 100644 --- a/couchpotato/runner.py +++ b/couchpotato/runner.py @@ -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):