Re: [web2py] Re: CRON or Background script?

2011-07-23 Thread Ismael Serratos
Thank you ron_m!!! That worked more than fine!


On Wed, Jul 20, 2011 at 11:16 AM, ron_m  wrote:

> Run 2 copies of web2py, one for the script and the other for the web site.
> If the database is SQLite you will end up with blocking problems if the
> background task takes too long.
>


Re: [web2py] Re: CRON or Background script?

2011-07-20 Thread ron_m
Run 2 copies of web2py, one for the script and the other for the web site. 
If the database is SQLite you will end up with blocking problems if the 
background task takes too long.


Re: [web2py] Re: CRON or Background script?

2011-07-19 Thread pbreit
Here is what the Book recommends:

python web2py.py -S app -M -N -R applications/app/private/myscript.py



Re: [web2py] Re: CRON or Background script?

2011-07-19 Thread Ismael Serratos
OK, my script is working fine, but the problem is this, I'm launching this
script:

import time

print "Initializing booking daemon @_@"

while True:
allBookings = db(db.current_bookings).select()

for booking in allBookings:
if booking.project != 'foo':

print str(booking)

prName = booking.project
platf = booking.platform


table = getattr(db, '%s'%prName)

toUpdate = db(table.id == platf).select()

for t in toUpdate:
t.update_record(platform_owner = 'Free')


print "Row Updated"

else:
print "Nothing Updated"
None
db.commit()
time.sleep(30)

like this:

python web2py.py -a 123 -i 127.0.0.1 -p80 -S init -M -N -R
applications/init/private/bot.py

And if I check my DB my script is doing its job, but if I launch it like
this I can't go to the website! (I guess that's because the -S init) but if
I erase it, the Script doesn't work.



On Mon, Jul 18, 2011 at 11:09 PM, Ismael Serratos wrote:

> I tried putting it into a controller, also as a separated file into private
> folder
>
>
>
>
>
> On Mon, Jul 18, 2011 at 8:36 PM, pbreit  wrote:
>
>> Where is this code located and how are you calling it? If it's in a
>> controller, you may need to call bookings() with an argument.
>>
>> Did you review this:
>>
>> http://web2py.com/book/default/chapter/04?#Background-Processes-and-Task-Queues
>>
>
>


Re: [web2py] Re: CRON or Background script?

2011-07-18 Thread Ismael Serratos
I tried putting it into a controller, also as a separated file into private
folder




On Mon, Jul 18, 2011 at 8:36 PM, pbreit  wrote:

> Where is this code located and how are you calling it? If it's in a
> controller, you may need to call bookings() with an argument.
>
> Did you review this:
>
> http://web2py.com/book/default/chapter/04?#Background-Processes-and-Task-Queues
>


[web2py] Re: CRON or Background script?

2011-07-18 Thread pbreit
Where is this code located and how are you calling it? If it's in a 
controller, you may need to call bookings() with an argument.

Did you review this:
http://web2py.com/book/default/chapter/04?#Background-Processes-and-Task-Queues