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:
|
||||
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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue