summaryrefslogtreecommitdiffstats
path: root/patchwork/management/commands/cron.py
diff options
context:
space:
mode:
Diffstat (limited to 'patchwork/management/commands/cron.py')
-rwxr-xr-xpatchwork/management/commands/cron.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/patchwork/management/commands/cron.py b/patchwork/management/commands/cron.py
new file mode 100755
index 0000000..6217e75
--- /dev/null
+++ b/patchwork/management/commands/cron.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+from django.core.management.base import BaseCommand, CommandError
+from patchwork.utils import send_notifications, do_expiry
+
+class Command(BaseCommand):
+ help = ('Run periodic patchwork functions: send notifications and '
+ 'expire unused users')
+
+ def handle(self, *args, **kwargs):
+ errors = send_notifications()
+ for (recipient, error) in errors:
+ self.stderr.write("Failed sending to %s: %s" %
+ (recipient.email, ex))
+
+ do_expiry()
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
+