I have a simple application whose scheduler automatically backs up rolling 
log files in a database. 
There is an option in the controller to manually update whenever you want 
(rather than waiting for the log to roll).
The scheduler task has to handle such cases by comparing two versions of 
the log file to avoid duplication (the instance at the time of manual 
update, and the instance at the time of roll-over)

The source of the files looks like this

<https://lh3.googleusercontent.com/-pAVmfnjxJ9w/V0URGeqr1HI/AAAAAAAALlM/AbULjjyP9PY-G81IqXfFVyyCs0c5C3UOgCLcB/s1600/Untitled3.png>

I'm seeing this error in the database logs for the failed scheduled task:

*Traceback (most recent call last):*

*   File "/home/www-data/web2py/gluon/scheduler.py", line 315, in executor*

*     result = dumps(_function(*args, **vars))*

*   File "applications/viewer/models/scheduler.py", line 127, in 
wrapper_monitor*

*     old_file = open(os.path.join(request.folder, 'temp', 
'wrapper.log.old'), 'w+')*

* IOError: [Errno 13] Permission denied: 
'applications/viewer/temp/wrapper.log.old'*



I believe it is failing on line 121 because the log.new is not blank ( and 
the script fails again at 127 due to same permission error)


<https://lh3.googleusercontent.com/-4HCvHNy96UA/V0UPwYOSeGI/AAAAAAAALlA/4K9DQaUiiMQg3G0EWHEhULIswMaOzi35QCLcB/s1600/Untitled.png>

This is what is left over after the error (it would normally clean up after 
itself, had it completed successfully)

<https://lh3.googleusercontent.com/-SC2n_c-mQk4/V0UQhO19KqI/AAAAAAAALlI/VvsinBYd_BAH4gPQtf5iA368Okyx5zdRACLcB/s1600/Untitled2.png>


So I restored the log files to a state that the scheduler is designed to 
handle, copy/pasted the scheduler task logic into the controller, and 
manually executed it (via url in browser), and everything works great.

This is what I see afterwards (commented out the code that cleans up after 
itself).

<https://lh3.googleusercontent.com/-Iv_doOSbVl8/V0UR0od4iLI/AAAAAAAALlc/2zxN8t18EqU6dh1m2JVncoY14gBtqPUoACLcB/s1600/Untitled4.png>


This seems like a user/permissions 101 issue to me but I am pretty new to 
this whole Linux thing. I am running Linux Mint 17.3 and used the included 
script for Ubuntu to deploy web2py.


To start the scheduler I am executing *nohup python web2py.py -K <appname> 
&*


The resulting Python process shows up as my username. The apache service 
shows up as www-data. The service that is generating the logs is also under 
my username, if that matters.



Any help appreciated in getting this thing to run in the model via 
scheduler.

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to