time event

44 views
Skip to first unread message

Hassan Alnatour

unread,
May 21, 2012, 8:14:30 AM5/21/12
to web...@googlegroups.com
Dear ALL,

How can let my web2py application send an email every day at 12 pm ??


Best regards,

Manuele Pesenti

unread,
May 21, 2012, 8:21:36 AM5/21/12
to web...@googlegroups.com
Il 21/05/2012 14:14, Hassan Alnatour ha scritto:
> Dear ALL,
>
> How can let my web2py application send an email every day at 12 pm ??

try read this...

http://web2py.com/books/default/chapter/29/4?search=scheduler

cheers

M.
>
>
> Best regards,

hasan alnator

unread,
May 21, 2012, 8:23:02 AM5/21/12
to web...@googlegroups.com

But this is experimental !! i need somthing done before

Manuele Pesenti

unread,
May 21, 2012, 9:05:39 AM5/21/12
to web...@googlegroups.com
Il 21/05/2012 14:23, hasan alnator ha scritto:
> But this is experimental !! i need somthing done before

what about http://web2py.com/books/default/chapter/29/4?search=cron#Cron ?

M.

hasan alnator

unread,
May 21, 2012, 9:30:37 AM5/21/12
to web...@googlegroups.com
Can you Please Show me An Example Or Something , I cant understand  it 


Best Regards,

Massimo Di Pierro

unread,
May 21, 2012, 11:06:27 AM5/21/12
to web...@googlegroups.com
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.

hasan alnator

unread,
May 21, 2012, 11:10:30 AM5/21/12
to web...@googlegroups.com
But if i want a website to do that forever , i just need to go to the shell i do  python web2py.py -K yourapp one time 

Massimo Di Pierro

unread,
May 21, 2012, 11:17:37 AM5/21/12
to web...@googlegroups.com
Yes. You just need to make sure the background process is running. From appadmin you start, stop, restart, count your tasks and check their status.
Reply all
Reply to author
Forward
0 new messages