On Monday, September 2, 2019 at 8:23:57 AM UTC-7, Francis Windram wrote:
>
> Hi All,
>
> Seems like a simple question here but I am struggling with finding an 
> elegant solution.
>
> I have a scheduler running with one task that runs at around 2200 every 
> night, then queues the next run at 2200 the next day. However I am at a 
> loss on how to trigger off the first run (aside from a one-off script to 
> schedule the first run)
>
> Adding a piece of code in the model which checks whether an eod_run job is 
> in the scheduler table and schedules one if not seems like it adds a lot of 
> overhead, considering the models are run very regularly.
> Assuming that all things work properly, once the scheduler runs one job, 
> it should just queue the next one, but I'm not sure if that persists over 
> server shutdowns.
>
> Do you have any suggestions? I could drop down and use a cron job on the 
> server itself, or using the cron functionality in web2py, but that feels 
> like stepping backwards when we have a perfectly functional scheduler 
> already enabled.
>
> Thanks!
>


Have a controller function that runs once (basically a script) /  You can 
put this in your startup files if you want.  (My server is restarted by 
hand more often than by reboot, so I haven't bothered with the startup 
part; I'm still editing modules used by the scheduler fairly often).

See
<URL:http://web2py.com/books/default/chapter/29/13/deployment-recipes#Start-the-scheduler-as-a-Linux-service-upstart->
and
'<http://web2py.com/books/default/chapter/29/13/deployment-recipes#Initial-Queuing-of-a-Repeating-Task>

/dps

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/8b7d1915-7574-4197-befd-6b9a1282f8a5%40googlegroups.com.

Reply via email to