return config
+notices_seq = []
problems_seq = []
problems_per_db = {}
global_expires = []
# global problems_per_db
# if not host in problems_per_db: problems_per_db[host] = {}
# problems_per_db[host][db] = True
+def note_info(key, value, pre=None):
+ global notices_seq
+ if pre is None:
+ notices_seq.append("%s: %s"%(key, value))
+ else:
+ notices_seq.append("[%s] %s: %s"%(pre, key, value))
def note_warning(key, value, pre=None):
global problems_seq
os.chdir(config['rootdir'])
for dir in os.listdir('.'):
+ if dir.startswith('.') or dir.endswith('.old'):
+ note_info('IGNORED', dir)
+ continue
+
if not os.path.isdir(dir):
- note_warning('NOT-A-DIR', dir)
+ if min(os.path.getmtime(dir), os.path.getctime(dir)) + 3600*4 > time.time():
+ note_info('IGNORED', dir)
+ else:
+ note_warning('NOT-A-DIR', dir)
continue
if not dir in config['backups']:
basefn = '%s.BASE.%s-%s.tar.gz'%(db, info['label'], info['start wal location'].split(' ',2)[0].replace('/', '_'))
baseffn = os.path.join(dir, basefn)
if not basefn in files:
- note_warning_db(dir, db, 'MISSING-BASE', basefn)
- continue
+ basefn = '%s.BASE.%s.tar.gz'%(db, info['label'])
+ baseffn = os.path.join(dir, basefn)
+ if not basefn in files:
+ note_warning_db(dir, db, 'MISSING-BASE', basefn)
+ continue
files.remove(basefn)
if backup_state[db]['can_expire_next']:
backup_state[db]['expires'].append(baseffn)
for p in problems_seq:
print p
+for p in notices_seq:
+ print p
if options.expire:
for f in global_expires: