Skip to content

Commit

Permalink
Added Haystack search index auto-update script for cron.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdeboard committed May 6, 2011
1 parent 4c29bd2 commit 8c27b5c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -20,5 +20,4 @@ yukimport/
yuk/migrations/
yuk/whoosh/*
/a/mattdeboard.net/yukproj/yuk/migrations/
srchupdate.py

23 changes: 23 additions & 0 deletions srchupdate.py
@@ -0,0 +1,23 @@
import os
import logging

domain_dir = "/a/mattdeboard.net/"
appdir = domain_dir + "src/yukproj/"
whoosh_dir = appdir + "yuk/whoosh/"

def update():
logging.basicConfig(filename='/a/mattdeboard.net/src/index.log',
level=logging.INFO,
format='%(asctime)s %(message)s',
datefmt='%m/%d/%Y %I:%M:%S %p')
logging.info('Starting index update.')
os.system("cd %s; . bin/activate; cd %s; sudo chown matt:matt %s; sudo chow"
"n matt:matt %s*; ./manage.py update_index; sudo chown www-data:"
"www-data %s; sudo chown www-data:www-data %s*; sudo /etc/init.d/"
"apache2 force-reload" % (domain_dir, appdir, whoosh_dir,
whoosh_dir, whoosh_dir, whoosh_dir))
logging.info('Index successfully updated.')

if __name__ == '__main__':
update()

0 comments on commit 8c27b5c

Please sign in to comment.