Please open a ticket about this. cron was not designed to do this but there 
is no reason it cannot do it.

On Tuesday, 22 May 2012 22:33:57 UTC-5, Michael Toomim wrote:
>
> I'm finding multiple problems getting cron to start the scheduler. Here's 
> the cron line:   
> @reboot dummyuser python web2py.py -K utility
> ...but it does not work without modifying web2py source.
>
> First, let's get an easy bug out of the way. The web2py book gives this 
> example for @reboot:
>
> @reboot * * * * root *mycontroller/myfunction
>
> But those asterisks shouldn't be there for @reboot tasks. Can we remove 
> them from the book?
>
> Now, when I put that line into my crontab and run web2py, it gives me this 
> error:
>
> web2py Web Framework
> Created by Massimo Di Pierro, Copyright 2007-2011
> Version 1.99.7 (2012-03-04 22:12:08) stable
> Database drivers available: SQLite3, pymysql, psycopg2, pg8000, CouchDB, 
> IMAP
> Starting hardcron...
> please visit:
>         http://192.168.56.101:8000
> use "kill -SIGTERM 10818" to shutdown the web2py server
> Exception in thread Thread-2:
> Traceback (most recent call last):
>   File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner
>     self.run()
>   File "/home/toomim/projects/utility/web2py/gluon/newcron.py", line 234, 
> in run
>     shell=self.shell)
>   File "/usr/lib/python2.6/subprocess.py", line 633, in __init__
>     errread, errwrite)
>   File "/usr/lib/python2.6/subprocess.py", line 1139, in _execute_child
>     raise child_exception
> OSError: [Errno 2] No such file or directory
>
> This is an error in subprocess.Popen. I inserted some print statements and 
> found that it's calling it like this:
> subprocess.Popen('python web2py.py -K utility')
>
> This is incorrect, it should be:
> subprocess.Popen(['python', 'web2py.py' '-K' 'utility'])
>
> I was able to make it work by adding a call to split(), as you can see 
> here (in newcron.py: cronlauncher.run()):
>     def run(self):
>         import subprocess
>         proc = subprocess.Popen(self.cmd.split(),
>
> But I do not understand how anybody could have made this work before, 
> without adding a split() call? And what confuses me further is that there 
> is an explicit join() call in the __init__() method that runs immediately 
> beforehand, as if we really did NOT want to have lists:
>
>         elif isinstance(cmd,list):
>             cmd = ' '.join(cmd)
>
> So does cron @reboot work for anybody running a script? It seems 
> impossible for it to work right now. Is this a bug?
>
> Finally, it would be great if we did not have to pass in a dummy user to 
> each cron line that does nothing...
>

Reply via email to