Hi Achipa,

While waiting for the ultimate patch for hardcron, I manage to give
the current web2py 1.56.4 's cron some other test. Some found issues
are listed below. They are not necessarily to be fixed, but if you can
somehow improve them, that is better.

1. In the crontab file, usually we write
    #0-59/1     *       *       *       *       root 
/path/to/some/executable_file
But I found that, on Windows platform, "/" are not recognized as a
path separater, but a command line switch prefix. Not what we want. So
it would better that crontab file can use "/" as path separater on
both Linux and Windows, perhaps more other platforms.

2. It is said that, writing a stand alone script file to access the
application's sqlite db, is impossible due to the sqlite lock issue.
So I decide to move all the real cron jobs into web2py's controller
file, let the crontab only serves as a general trigger. Here is what I
did.

In crontab:
    */1 *       *       *       *       root *applications/myapp/cron/trigger.py

In trigger:
  import urllib,logging
  t='http://127.0.0.1:80/%s/default/trigger'%request.application
  logging.warn('Trigger: %s ...'%t)
  urllib.urlopen(t).read()

In controller default.py:
  def trigger():
    do_some_real_job_such_as_db_maintanence()

You see I hardcode "127.0.0.1:80" inside the trigger.py.  Actually I
tried to use request.env.http_post, but,
  # At least when triggered by softcron (on Windows platform),
  # request.env.http_host is ALWAYS 127.0.0.1:8000
  # rather than the real server addr and port of main web2py
process :-/
so this trigger.py is not flexible enough. Any suggestions?


On Mar2, 6:36pm, AchipA <attila.cs...@gmail.com> wrote:
>
> I have not forgotten about your issue, it will be in trunk ASAP.
>

> > > > On Feb26, 7:35pm, AchipA <attila.cs...@gmail.com> wrote:
>
> > > > > Agreed, I do intend of changing this in the future.
> > > > > Probably will have to introduce a file-based scheme (which is in the
> > > > > works anyway to prevent multi-process race conditions), but it's not
> > > > > that easy as workarounds for GAE will be needed..
>
> > > As a bonus feature, if you use db mode (required on GAE) you will get
> > > a 'free' cron log, too.

--~--~---------~--~----~------------~-------~--~----~
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