Howzabout you make this into a wiki article under recipes? -tim
achipa wrote: > Long story short: > > Make a cron directory in your app, and a crontab file in it. The > format of the file is regular crontab (you have an example for > cleaning sessions in the admin app). One special hook is if you prefix > the application with a *, it will execute a web2py controller > (basically a wrapper for calling python -S app -M....), but you have a > commented out example for that in the admin crontab, too. > > If you're running standalone web2py (python web2py.py), or apache via > mod_proxy, you don't need to do anything, you get it for 'free', in a > spearate thread. This is know as 'hard cron' and is the recommended > cron mode. Tasks have no execution time limit. > > If you're running CGI or WSGI/FASTCGI, by default you have 'soft cron' > which means that your tasks will be executed in the first call to > web2py after the time specified in crontab (but AFTER processing the > page, so no delay to the user is visible). Obviously, this has some > uncertainty exactly when the task will be executed. This is why we a > third mode, 'external cron'. Running cron tasks will be aborted when > the webserver stops or restarts. > > Both soft and hard cron are platform independent, so even if you have > a windows machine, cron functionality will work without any changes. > > External cron is called from the system crontab. It's recommended if > you're running WSGI/Fastcgi and you have root access. Add something > along these lines to your system crontab: > > 0-59/1 * * * * web2py cd /var/www/web2py/ && > touch applications/admin/cron/cron.master && python web2py.py -C -D 1 > >>> /tmp/cron.output 2>&1 >>> > > (change the paths to the ones on your system, of course, and the > username if it's not web2py). Note that external cron has it's own > output (and will thus not output stuff to the same console as web2py > like the other two cron modes). > > That's it in a nutshell. If you have any problems with it just let me > know. > > On Jan 12, 10:48 am, David Marko <[email protected]> wrote: > >> Hi Massimo, >> can you drop some example how to use it in application? >> >> David >> >> On 12 Led, 04:54, Massimo Di Pierro <[email protected]> wrote: >> >> >>> Hi Attila, >>> >>> Uploaded your patch to trunk now! Excellent work! >>> >>> Massimo >>> > > > -- Timothy Farrell <[email protected]> Computer Guy Statewide General Insurance Agency (www.swgen.com) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

