forked from elmau/empresa-libre
Generar backups de sqlite
This commit is contained in:
parent
50a8c277bf
commit
f99a0da8d9
|
@ -1402,14 +1402,16 @@ def backup_dbs():
|
||||||
|
|
||||||
for rfc, data in rows:
|
for rfc, data in rows:
|
||||||
args = loads(data)
|
args = loads(data)
|
||||||
|
path_bk = _join(PATH_MEDIA, 'tmp', '{}.bk'.format(rfc.lower()))
|
||||||
if args['type'] == 'postgres':
|
if args['type'] == 'postgres':
|
||||||
path_bk = _join(PATH_MEDIA, 'tmp', '{}.bk'.format(rfc.lower()))
|
|
||||||
args = 'pg_dump -U postgres -Fc {} > "{}"'.format(
|
args = 'pg_dump -U postgres -Fc {} > "{}"'.format(
|
||||||
args['name'], path_bk)
|
args['name'], path_bk)
|
||||||
try:
|
elif args['type'] == 'sqlite':
|
||||||
result = _call(args)
|
args = 'gzip -c "{}" > "{}"'.format(args['name'], path_bk)
|
||||||
except Exception as e:
|
try:
|
||||||
log.info(e)
|
result = _call(args)
|
||||||
|
except Exception as e:
|
||||||
|
log.info(e)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue