From d48a2d08b0afe33c89acb2b9f985266886a2114d Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Wed, 2 Nov 2016 20:59:55 +0200 Subject: Added prune backups --- servo/management/commands/prunebackups.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 servo/management/commands/prunebackups.py diff --git a/servo/management/commands/prunebackups.py b/servo/management/commands/prunebackups.py new file mode 100644 index 0000000..7baebbc --- /dev/null +++ b/servo/management/commands/prunebackups.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- + +import subprocess +from django.conf import settings +from django.core.management.base import BaseCommand + + +class Command(BaseCommand): + def handle(self, *args, **options): + help = "Delete pg backups older than 3 months" + subprocess.call(['find', settings.BACKUP_DIR, + '-ctime', '+12w', '-type', 'f', + '-name', '*.pgdump', '-delete']) -- cgit v1.2.3