Commit 5f9e2ead authored by Chris Reffett's avatar Chris Reffett
Browse files

Add cleanlinks command to remove expired links, add sample

cron script and notes on setup in
parent eeb2c0aa
...@@ -42,3 +42,11 @@ $ pip install -r requirements.txt ...@@ -42,3 +42,11 @@ $ pip install -r requirements.txt
``` ```
and you should be good to go. and you should be good to go.
### Cron
In order to expire links, you need to set up a cron job to run the
expirelinks command regularly. A sample cron script is available in the
repository and is named go-cleanlinks.cron. Drop this in cron.hourly and
change the paths so that they point to the virtualenv activate script and
# Cron job to automatically expire outdated links, put this in cron.hourly
python ${MANAGE_PATH} expirelinks
from import BaseCommand
from django.utils import timezone
from go.models import URL
class Command(BaseCommand):
help = 'Removes expired links from the database'
def handle(self, *args, **options):
for toexpire in URL.objects.filter(
self.stdout.write("Removed URL %s (%s), expires %s" % (, toexpire.short, toexpire.expires))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment