Scheduler task every first day of every month ?

81 views
Skip to first unread message

António Ramos

unread,
Dec 9, 2016, 5:17:14 AM12/9/16
to web...@googlegroups.com
Hello all,
 i dont know how to define a task to run every 1st day of every month.

Thank you
Antonio

黄祥

unread,
Dec 9, 2016, 6:44:53 AM12/9/16
to web2py-users
pls try :
controllers/default.py
start_bom = '%s-%s-01 00:00:00' % (request.now.year, request.now.month)

def queue_task_0():
scheduler.queue_task('scheduler_name', start_time = start_bom, next_run_time = start_bom)
session.flash = T("Task 0 Queued")
redirect(URL('index.html') )

best regards,
stifan

Marlysson Silva

unread,
Dec 9, 2016, 7:18:44 AM12/9/16
to web2py-users
The problem it with make the sheduler or with date?

To try using some_year/some_month/1 dont't work?

António Ramos

unread,
Dec 9, 2016, 7:18:47 AM12/9/16
to web...@googlegroups.com
and via appadmin how do i do that?

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

António Ramos

unread,
Dec 9, 2016, 8:44:34 AM12/9/16
to web...@googlegroups.com
how do i define first day of every month ?

Imagem inline 1

--

Marlysson Silva

unread,
Dec 9, 2016, 9:09:40 AM12/9/16
to web2py-users
Why you don't make this programmatically? there you could use libs as calendar to get first day of the month..
Or get current day and calculate difference to next first day of the month
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.

黄祥

unread,
Dec 9, 2016, 4:50:13 PM12/9/16
to web2py-users
just an idea why not set default value?
e.g.
from gluon.scheduler import Scheduler
scheduler = Scheduler(db)

start_bom = '%s-%s-01 00:00:00' % (request.now.year, request.now.month)
db.scheduler_task.start_time = start_bom
db.scheduler_task. next_run_time = start_bom

best regards,
stifan

Dave S

unread,
Dec 9, 2016, 5:06:26 PM12/9/16
to web2py-users


On Friday, December 9, 2016 at 5:44:34 AM UTC-8, Ramos wrote:
how do i define first day of every month ?

Imagem inline 1

2016-12-09 12:18 GMT+00:00 Marlysson Silva <marly...@gmail.com>:
The problem it with make the sheduler or with date?

To try using some_year/some_month/1 dont't work?


Em sexta-feira, 9 de dezembro de 2016 07:17:14 UTC-3, Ramos escreveu:
Hello all,
 i dont know how to define a task to run every 1st day of every month.

Thank you
Antonio

There's this post I made in August.  I'm trying to figure out where I made the other post I mention-in-passing.


/dps
 

António Ramos

unread,
Dec 9, 2016, 5:27:27 PM12/9/16
to web...@googlegroups.com
start_time=next_run_time???

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe@googlegroups.com.

Niphlod

unread,
Dec 10, 2016, 4:13:57 AM12/10/16
to web2py-users
this is an already-solved problem. fetch scheduler.py from the master repo: you can schedule recurrences using the cronline parameter.
Reply all
Reply to author
Forward
0 new messages