This works for me.  I have a system crontab like this...

*/5 * * * * python /home/www-data/web2py/web2py.py -S init -M -N -R /
home/www-data/web2py/applications/init/modules/cron.py

And cron.py runs just like it should.  Here's a basic layout that you
can use to test it's working...

==modules/cron.py==
#!/usr/bin/env python
# coding: utf8

import os
import sys
import datetime
message_log = ['Started at %s' % datetime.datetime.now()]

try:
    # Put your processing stuff here

    db.commit()
    message_log.append('Process good')
except:
    import traceback
    message_log.append('Cron Failure: %s' % traceback.format_exc())

message_log.append('Ended at %s' % datetime.datetime.now())
mail.send(settings.system_email, "Cron Report",
'\n'.join(message_log))





On May 17, 12:42 pm, pbreit <pbreitenb...@gmail.com> wrote:
> I'm still struggling with how to deploy cron in production.
>
> I currently have a crontab on my production server set up with:
>
> 0-59/1 * * * * cd /var/web2py && python web2py.py -C -D 1 >>
> /tmp/cron.output 2>&1
>
> And a couple tasks in my web2py crontab:
> */1 * * * * root *cron/email_watchlist
> 0 2 * * * root *cron/google_feed
>
> It seems like the */1 tasks get run but not the 0 2 one.
>
> I'm about to give up and just wget URLs:
> */1 * * * * wgethttp://localhost/cron/email_watchlist>/dev/null 2>&1
> 00 2 * * * wgethttp://localhost/cron/google_feed>/dev/null 2>&1
>
> Is this how external cron is supposed to work? What are other people doing
> that works? Any suggestions?

Reply via email to