I use Windows and Apache 2.2
in crontab:
#crontab
*/1 * * * * root *cron/ws_run
in controller cron.py:
if not request.is_local: raise HTTP(200,'error')
def ws_run():
print 'ws_run'
rec = db.my_recs[1]
rec.update_record( ref_id = (rec.ref_id or 0) + 1 )
db.commit()
return '%s' % rec.ref_id
when I call it by url 127.0.01.:8000/cron/ws_run - all work
I restart Apache and wait...
but- nothing is happened ((
in error.log no mess 'ws_run'
and in db.recs[1] no updates
I try edit code in wsgihandler.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <[email protected]>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
This is a WSGI handler for Apache
Requires apache+mod_wsgi.
In httpd.conf put something like:
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias / /path/to/wsgihandler.py
"""
# change these parameters as required
LOGGING = False
SOFTCRON = False
HARDCRON = True
import sys
import os
path = os.path.dirname(os.path.abspath(__file__))
os.chdir(path)
if not os.path.isdir('applications'):
raise RuntimeError('Running from the wrong folder')
sys.path = [path] + [p for p in sys.path if not p == path]
sys.stdout = sys.stderr
import gluon.main
if LOGGING:
application = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,
logfilename='httpserver.log',
profiler_dir=None)
else:
application = gluon.main.wsgibase
if SOFTCRON:
from gluon.settings import global_settings
global_settings.web2py_crontype = 'soft'
elif HARDCRON:
from gluon.settings import global_settings
global_settings.web2py_crontype = 'hard'
with
SOFTCRON = False - not worked
with
SOFTCRON = True - in apache logs error.log:
[Thu Jul 09 11:54:57 2015] [error] 2015-07-09 11:54:57,664 - web2py.cron -
newcron.py[LINE:139]# WARNING - WEB2PY CRON: Disabled because no file
locking
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.