From f99a0da8d904aad93e042a961135f6d22cd7ba71 Mon Sep 17 00:00:00 2001 From: Mauricio Baeza Date: Sun, 10 Dec 2017 01:06:24 -0600 Subject: [PATCH] Generar backups de sqlite --- source/app/controllers/util.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source/app/controllers/util.py b/source/app/controllers/util.py index 0e02d1b..50601ca 100644 --- a/source/app/controllers/util.py +++ b/source/app/controllers/util.py @@ -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