diff options
Diffstat (limited to 'servo/management/commands')
-rw-r--r-- | servo/management/commands/prunebackups.py | 13 |
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']) |