I have following line in crontab:
* * * * * root *cpe_lang/test_only
the function in controller is defined as:
@auth.requires( (request.client==None) or
(auth.has_membership('managers')) )
def test_only():
logging.error('Test cron')
logging.info(str(request))
if request.client != None:
logging.info('from user')
else:
logging.info('from cron')
Function is NOT executed.
and that is traceback:
Traceback (most recent call last):
File "web2py.py", line 20, in <module>
gluon.widget.start(cron=True)
File "/myapp/web2py/gluon/widget.py", line 759, in start
import_models=options.import_models, startfile=options.run)
File "/myapp/web2py/gluon/shell.py", line 174, in run
exec ('print %s()' % f, _env)
File "<string>", line 1, in <module>
File "/myapp/web2py/gluon/tools.py", line 2116, in f
'?_next='+urllib.quote(next))
File "/myapp/web2py/gluon/http.py", line 104, in redirect
Location=location)
gluon.http.HTTP
I can only execute the function it by hand. I was also trying to do it
with curl from cron
* * * * * /usr/bin/curl -u manager_user:my_pass
http://127.0.0.1:8000/my_app/cpe_lang/test_only
but i get the error:
Exception in thread Thread-19:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/threading.py", line 460, in __bootstrap
self.run()
File "/Users/msh/c_workspace/sara_refactor/web2py/gluon/newcron.py",
line 206, in run
shell=self.shell)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/subprocess.py", line 593, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/subprocess.py", line 1079, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
why No such file or directory?
I am sure curl is in that location.