Generar backups de sqlite

This commit is contained in:
Mauricio Baeza 2017-12-10 01:06:24 -06:00
parent 50a8c277bf
commit f99a0da8d9
1 changed files with 7 additions and 5 deletions

View File

@ -1402,14 +1402,16 @@ def backup_dbs():
for rfc, data in rows:
args = loads(data)
path_bk = _join(PATH_MEDIA, 'tmp', '{}.bk'.format(rfc.lower()))
if args['type'] == 'postgres':
path_bk = _join(PATH_MEDIA, 'tmp', '{}.bk'.format(rfc.lower()))
args = 'pg_dump -U postgres -Fc {} > "{}"'.format(
args['name'], path_bk)
try:
result = _call(args)
except Exception as e:
log.info(e)
elif args['type'] == 'sqlite':
args = 'gzip -c "{}" > "{}"'.format(args['name'], path_bk)
try:
result = _call(args)
except Exception as e:
log.info(e)
return