On 24 Jan 2014, at 6:54 PM, Jonathan Lundell <jlund...@pobox.com> wrote: > On 24 Jan 2014, at 4:05 PM, Alex <mrauc...@gmail.com> wrote: >> could you give more details? why do you start it that way, did you >> experience any problems with external cron? how does the command for the >> system cron exactly look like? does it have any disadvantages to external >> cron? >> >> any ideas how I could track down those issues? > > The general idea is that you can run a function directly from the command > line, so you can also run it directly from system cron. The difference > between that and "external cron" is that it completely bypasses web2py's > internal cron handling, which the last time I looked at it (it's been a > while) did not look reliable to me. > > Here's a sample from my crontab template (system crontab, not web2py > crontab). I run web2py in a virtualenv; hence the activate. The > controller/function is tasks/idf. > > 0 * * * * source %(virtualenv)s/bin/activate && cd %(web2pydir)s && python > web2py.py -J -M -S %(appname)s/tasks/idf -a "<recycle>" >> /tmp/cron.output > 2>&1
Alternatively, consider using the scheduler instead of cron. > > >> >> thanks >> >> On Saturday, January 25, 2014 12:55:50 AM UTC+1, Jonathan Lundell wrote: >> On 24 Jan 2014, at 3:38 PM, Alex <mrau...@gmail.com> wrote: >>> I've got a big issue with external cron jobs. In my application I've added >>> tasks to crontab which should be executed every day, e.g. >>> 0 0 * * * myapp *applications/myapp/cron/task_update_vacation_days.py >>> 30 0 * * * myapp >>> *applications/myapp/cron/task_insert_public_holidays.py >>> >>> Now I found out that the cron jobs are not executed every day on the live >>> server. The cron jobs are started from a system cron job as specified in >>> the documentation: >>> python web2py.py -J -C -D 1 >> /tmp/cron.customer.output >>> >>> The jobs are executed very irregular, some jobs get executed almost every >>> day and others just 2 times in the last 7 days. here is the output for >>> task_update_vacation_days: >>> INFO:web2py.cron:WEB2PY CRON (external): myapp executing >>> *applications/myapp/cron/task_update_vacation_days.py in >>> /srv/web/customer/web2py at 2014-01-25 00:00:02.179185 >>> INFO:web2py.cron:WEB2PY CRON (external): myapp executing >>> *applications/myapp/cron/task_update_vacation_days.py in >>> /srv/web/customer/web2py at 2014-01-18 00:00:02.291735 >>> >>> then I checked the syslog to make sure "web2py.py -J -C -D 1" was called >>> exactly every minute. so the problem seems to be that web2py somehow thinks >>> the task should not be started? how can this happen? does anyone have an >>> idea? >> >> What I've been doing is to run my cron jobs directly from system cron, using >> -S and -R. >> >> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) > > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.