Hi gentlemens,

web2py 1.56 with Achipa's cron patch is great. I just do a:
  copy applications/admin/cron applications/myapp/cron
and then modify the applications/myapp/cron/crontab, replace the
"admin" by "myapp", then the long time puzzle "old sessions" ( see
http://groups.google.com/group/web2py/browse_thread/thread/f731c8f9d18811a2
) is solved!  It is awesome!

I suggest the cron directory as well as the "expire old sessions"
ability should be enabled by default, otherwise almost each
application's session data is likely to consume all disk space hence
halt entire system sooner or later.

To do so, I suggest the welcome application should have its own cron/
expire_sessions.py etc. Further more, every new applications generated
by admin should better have its own cron/expire_sessions.py too. One
thing might be tricky here: currently the cron/crontab hardcode the
app name, so it need to be modified when being deployed into a new
application. Is there a way to make a same crontab which can work
inside different app, Achipa?

On Jan12, achipa <attila.cs...@gmail.com> wrote:
> Long story short:
>
> Make acrondirectory 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 'hardcron' and is the recommendedcronmode. 
> Tasks have no execution time limit.
>
> If you're running CGI or WSGI/FASTCGI, by default you have 'softcron'
> 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, 'externalcron'. Runningcrontasks will be aborted when
> the webserver stops or restarts.
>
> Both soft and hardcronare platform independent, so even if you have
> a windows machine,cronfunctionality will work without any changes.
>
> Externalcronis 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 externalcronhas it's own
> output (and will thus not output stuff to the same console as web2py
> like the other twocronmodes).
>
> 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 <dma...@tiscali.cz> wrote:
>
> > Hi Massimo,
> > can you drop some example how to use it in application?
>
> > David
>
> > On 12 Led, 04:54, Massimo Di Pierro <mdipie...@cs.depaul.edu> wrote:
>
> > > Hi Attila,
>
> > > Uploaded your patch to trunk now! Excellent work!
>
> > > Massimo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to