Files
test-auth/run-cron.py
Andrew Williams 07450ca5dd Moved service enable/disable functions to the update_access() function on the user profile
This will remove the need for the cronjob, but not totally, best still to run the cronjob to catch situations where the permission changes can be missed.
2010-03-24 14:52:08 +00:00

31 lines
631 B
Python
Executable File

#!/usr/bin/env python
"""Executes a Django cronjob"""
import sys
import logging
from django.core.management import setup_environ
import settings
setup_environ(settings)
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger('runcron')
try:
mod = __import__(sys.argv[1])
except ImportError:
raise Exception('Error creating service')
for i in sys.argv[1].split(".")[1:]:
mod = getattr(mod, i)
cron_class = getattr(mod, sys.argv[2])()
log.info("Starting Job %s in %s" % (sys.argv[2], sys.argv[1]))
#try:
cron_class.job()
#except:
# log.error("Error executing job, aborting.")
log.info("Job complete")