diff options
Diffstat (limited to 'servo/management')
-rw-r--r-- | servo/management/commands/dumpdb.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/servo/management/commands/dumpdb.py b/servo/management/commands/dumpdb.py index c319336..6032dc4 100644 --- a/servo/management/commands/dumpdb.py +++ b/servo/management/commands/dumpdb.py @@ -15,6 +15,10 @@ class Command(BaseCommand): s = settings.DATABASES['default'] db, user, pw = s['NAME'], s['USER'], s['PASSWORD'] fname = datetime.now().strftime('%Y%m%d_%H%M') + '.pgdump' + + if not os.path.exists(settings.BACKUP_DIR): + os.mkdir(settings.BACKUP_DIR) + path = os.path.join(settings.BACKUP_DIR, fname) os.putenv('PGPASSWORD', pw) subprocess.call(['pg_dump', '-Fc', db, '-U', user, '-f', path]) |