I have three background processes like this:
https://groups.google.com/d/msg/web2py/nxYZxyFvE3U/ZD6OicoL4LQJ

@reboot root *applications/init/private/release_pending_orders.py
@reboot root *applications/init/private/expire_items.py
@reboot root *applications/init/private/mail_queue.py

import time

while True:
    items = db(db.item.expire_date < request.now).select()
    for item in items:
        item.update_record(status='expired')
        db.commit()
    time.sleep(3600)


import time

while True:
    items = db(db.item.status=='pending').select()
    for item in items:
        item.update_record(status='active')
        purchase = db(db.purchase.item==item.id).select().first()
        purchase.update_record(status='abandoned')
        db.commit()
    time.sleep(3600)

Reply via email to