Forgive me if I have misunderstood your question, but it sounds like you are 
expecting web2py to start external cron for you. If this is the case, then 
that is incorrect. What "external cron" means is a completely separate 
process (in this case, the Unix cron scheduler) that needs to run a script. 
When running a background task that you would normally use cron for, you can 
start this task in a web2py environment so that it can use db, cache, etc. 
To do this, you would run using a cron line similar to this (in crontab -e, 
for example):

0 9 * * 1-5    python /var/web2py/web2py.py -S app_name -M -J -R 
scripts/my_script.py

At 9AM, Monday through Friday, this runs the my_script.py file in your 
application's /scripts folder. The -J tells web2py that it is being executed 
as a cron job so that it doesn't start Rocket and open up a port needlessly. 
This also allows your applications to detect whether a script was executed 
by a web request or by a cron script. Why would this be important, you ask?

In one of my applications, I want to force all traffic over SSL, so in my 
model, I have this:

############ FORCED SSL #############
from gluon.settings import global_settings
if global_settings.cronjob:
    print 'Running as shell script.'
elif not request.is_https:
    session.secure()
    redirect('https://%s/%s' % (request.env.http_host, request.application))
#####################################

Since trying to redirect a cron script to SSL will fail, I want to check for 
that and only force HTTP connections to redirect to use HTTPS.

So to answer your question, you do not pass arguments to mod_wsgi. You start 
another web2py instance using -S, -M, and -J options to run a background 
process. Hope that helps.

Reply via email to