You can have a function but the script must call it: from time import ctime def test_cron(): db.dbg.insert(dbgmsg=ctime()) db.commit() return "ready" test_cron() #<<<<<<
On Nov 4, 10:24 am, Vinicius Assef <vinicius...@gmail.com> wrote: > Sverre, I think you must use your own application crontab, located at > applications/your_app/cron > > I suggest you create a python script without any functions inside it, > to isolate your cron job, and put it in > applications/your_app/private/. > I do this here and it works nice. > > Following my advice, your crontab would be like it: > */2 * * * * root *applications/your_app/private/test_cron.py > > And your test_cron.py will have no def inside it. > > -- > Vinicius Assef. > > On Thu, Nov 4, 2010 at 8:10 AM, Sverre <sverreodeg...@gmail.com> wrote: > > My cron tab looking like this > > > #crontab > > */2 * * * * root *sys/test_cron > > @hourly root *applications/mm/cron/expire_sessions.py > > > but this doesn' work. My test cron function is > > > from time import ctime > > def test_cron(): > > db.dbg.insert(dbgmsg=ctime()) > > db.commit() > > return "ready" > > > If I trigger this function manually it's working. Web2Py is installed > > as a Windows Service. Is someone able to help? > >