Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Haystack search index auto-update script for cron.
- Loading branch information
mattdeboard
committed
May 6, 2011
1 parent
4c29bd2
commit 8c27b5c
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,5 +20,4 @@ yukimport/ | |
yuk/migrations/ | ||
yuk/whoosh/* | ||
/a/mattdeboard.net/yukproj/yuk/migrations/ | ||
srchupdate.py | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
|