aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2016-11-02 20:59:55 +0200
committerFilipp Lepalaan <filipp@mac.com>2016-11-02 20:59:55 +0200
commitd48a2d08b0afe33c89acb2b9f985266886a2114d (patch)
treeaa53c070e66c2a10a93da1a8bf7f729de4c85f18
parentf5b69467d197e1139e4fdb06b82de54f993b3f33 (diff)
downloadServo-d48a2d08b0afe33c89acb2b9f985266886a2114d.tar.gz
Servo-d48a2d08b0afe33c89acb2b9f985266886a2114d.tar.bz2
Servo-d48a2d08b0afe33c89acb2b9f985266886a2114d.zip
Added prune backups
-rw-r--r--servo/management/commands/prunebackups.py13
1 files changed, 13 insertions, 0 deletions
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'])