I just put together an Ubuntu VM to test in and yeah, the scheduler doesn't work quite right there either. First off it appears that the DB tables don't get defined there either without intervention -- I changed migrate=False to migrate=True on line 265 and then running *python web2py.py -K scheduler* worked better. At least under linux only one web2py process gets started. The scheduler also spotted my task and attempted to run it ... and failed. But at least in Linux the scheduler actually recognizes and records that the task failed. Also, hitting ctrl+c only once successfully kills off the scheduler unlike under Windows where you've got to do it over and over again.
It looks like the task fails because os.environ['WEB2PY_PATH'] is not defined. I thought that adding the -f option to web2py.py was supposed to set this but that doesn't work either (as in *python web2py.py -K scheduler -f */full/path/to/web2py/). Below is a (truncated) record of a scheduler run under linux: --------------------------- brian@brian-Ubuntu1104:~/web2py/trunk/web2py$ python web2py.py -K scheduler web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2011 Version 1.98.2 (2011-09-03 22:30:05) Database drivers available: SQLite3, pymysql starting scheduler for "scheduler"... DEBUG:root:defining tables (migrate=True) DEBUG:root:looping... DEBUG:root: grabbing all queued tasks DEBUG:root:thread building own DAL object DEBUG:root:defining tables (migrate=False) DEBUG:root: grabbed 0 tasks DEBUG:root:sleeping... DEBUG:root:........recording heartbeat DEBUG:root: freeing workers that have not sent heartbeat DEBUG:root:looping... DEBUG:root: grabbing all queued tasks DEBUG:root: grabbed 0 tasks DEBUG:root:sleeping... ... DEBUG:root:........recording heartbeat DEBUG:root:looping... DEBUG:root: grabbing all queued tasks DEBUG:root: grabbed 1 tasks DEBUG:root: releasing all but one (running) DEBUG:root: new scheduler_run record INFO:root:new task 1 "demo1" scheduler.demo1 DEBUG:root: new task allocated: scheduler.demo1 DEBUG:root: task starting DEBUG:root: task started DEBUG:root: new task report: FAILED DEBUG:root: traceback: Traceback (most recent call last): File "/home/brian/web2py/trunk/web2py/gluon/scheduler.py", line 119, in executor os.chdir(os.environ['WEB2PY_PATH']) File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__ raise KeyError(key) KeyError: 'WEB2PY_PATH' DEBUG:root: task completed or failed DEBUG:root: recording task report in db (FAILED) INFO:root:task completed (FAILED) DEBUG:root:looping... DEBUG:root: grabbing all queued tasks DEBUG:root: grabbed 0 tasks DEBUG:root:sleeping... DEBUG:root:........recording heartbeat DEBUG:root:looping... DEBUG:root: grabbing all queued tasks DEBUG:root: grabbed 0 tasks DEBUG:root:sleeping... ... DEBUG:root:........recording heartbeat DEBUG:root:looping... DEBUG:root: grabbing all queued tasks DEBUG:root: grabbed 0 tasks DEBUG:root:sleeping... DEBUG:root:........recording heartbeat DEBUG:root: freeing workers that have not sent heartbeat DEBUG:root:looping... DEBUG:root: grabbing all queued tasks DEBUG:root: grabbed 0 tasks DEBUG:root:sleeping... .. DEBUG:root:........recording heartbeat DEBUG:root:looping... DEBUG:root: grabbing all queued tasks DEBUG:root: grabbed 0 tasks DEBUG:root:sleeping... DEBUG:root:........recording heartbeat DEBUG:root:looping... DEBUG:root: grabbing all queued tasks DEBUG:root: grabbed 0 tasks DEBUG:root:sleeping... ^CINFO:root:die! brian@brian-Ubuntu1104:~/web2py/trunk/web2py$