In a model:
from gluon.scheduler import Scheduler
def mytask():
# do something
return
scheduler=Scheduler(db,tasks=dict(mytask=mytask)
if db(db.scheduler_task).isempty():
db.scheduler_task.insert(
application_name = 'yourapp',
task_name = 'mytask',
function_name = 'mytask',
repeats = 0, # unilimted
period = 24*3600) # seconds
Then from the shell run
python web2py.py -K yourapp
this will create a background process which picks and runs the scheduled tasks. You can monitor tasks using appadmin.