Massimo,

The problem is in def parsecronline() there needs to be an extra elif
clause to deal with that -1 minute value for @reboot tasks.

for (s, id) in zip(params[:5], ['min', 'hr', 'dom', 'mon', 'dow']):

        if not s in [None, '*']:
            task[id] = []
            vals = s.split(',')
            for val in vals:
                print val
                if val.find('/') > -1:
                    task[id] += rangetolist(val, id)
                elif val.isdigit():
                    task[id].append(int(val))
                elif val == "-1":
                    #...@reboot line
                    task[id].append(int(-1))
    task['user'] = params[5]
    task['cmd'] = params[6]
    return task

unfortunately, -1 fails the isdigit() test and therefore instead of
min containing [-1] it contains nothing [].

I'm going to see if I can't figure out the windows space in path issue
next.

~Brian

On Jan 30, 8:11 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Hi Brian,
>
> can you help me debug this.
>
> In gluon/contrib/cron.py there is a line in function crondance:
>
>             elif not startup and task.get('min',[])==[-1]:
>                 continue
>
> @reboot startup is supposed to be true the first time only and task.get
> ('min',[]) is supposed to be ==[-1].
>
> Is this not the case? Can you add a print statement before that line
> to print statup and task?
>
> massimo
>
> On Jan 30, 7:52 pm, Brian M <bmere...@gmail.com> wrote:
>
>
>
> > OK, just pulled latest trunk out of the google code hg repo and
> > @reboot seems to be working on Win7 - actually it's working a bit too
> > good. Not only does it run on web2py startup, but it CONTINUES to run
> > once a minute from then on!
>
> >  I did notice that I had the @reboot crontab syntax wrong earlier. It
> > is supposed to be just
>
> > @reboot root    *mycontroller/myfunction
>
> > and NOT
>
> > �...@reboot *       *       *       *       root *mycontroller/myfunction
>
> > as I had tried before. (BTW, the incorrect syntax is shown at the
> > bottom of the docs page -http://web2py.com/examples/default/cron.
> > Though the correct form is towards the top of the same page). If you
> > use that syntax, you get an error message at the console:
> >     invalid application name: testing/    *    *    *default/
> > on_reboot.
>
> > ~Brian
>
> > On Jan 30, 5:39 pm, Brian M <bmere...@gmail.com> wrote:
>
> > > Well on my Win7 setup with source distribution of web2py I can confirm
> > > that @reboot cron lines do not run when I start up web2py. The same
> > > cron line with a normal time declaration does run just fine.
>
> > > #...@reboot does not run
> > > @reboot *       *       *       *       root *reboot/on_reboot
> > > #But with normal time syntax runs just fine
> > > 0-59/5 *        *       *       *       root *reboot/on_reboot
>
> > > As far as spaces in file path names affecting things, I'd need more
> > > specific information about what is in people's crontab files. When I
> > > was trying to test @reboot I purposely stuck web2py in a path that
> > > contained spaces and didn't seem to have any problems. Normally within
> > > python scripts I use os.path.join() to build up my file paths so that
> > > I don't have to worry about the slashes - os.path.join('C:\',
> > > 'Documents and Settings', 'Username', 'My Documents', 'folder', 'sub
> > > folder', 'file.txt') works just fine.
>
> > > Also in my crontab, I could execute a non-web2py python script with
>
> > > 0-59/2  *       *       *       *       root python 
> > > "C:\Users\Brian\Documents\some project
> > > \scripts\some_script.py" >> cron.log
>
> > > On Windows you do need to add the python executable to your path if
> > > you don't want to always have to type C:\Python26\python.exe script.py
> > > - for some reason the windows python installer doesn't do it
> > > automatically. If you don't know already, here's how...
>
> > > Win7:
> > > Right click on "My Computer" and choose "Properties"
> > > On the left side click the "Advanced System Settings" link.
> > > Go to the "Advanced" tab
> > > Click on the "Environment Variables" button at the bottom.
> > > In the "System Variables" section (the bottom one), scroll down to
> > > "Path" and click once to highlight.  (If you want it only for your
> > > use, add it to the user variables. You'll need to add a new "Path"
> > > variable)
> > > Click the "Edit..." button.
> > > In the "Variable value" field, add ";C:\Python26\" on to the end -
> > > without the quotes, the semi-colon is the separator between the
> > > multiple entries. (If you're using Python 2.5 then use C:\Python25)
> > > Click "OK" three times to get rid of all the windows.
>
> > > WinXP:
> > > Right click on "My Computer" and choose "Properties"
> > > Go to the "Advanced" tab.
> > > Follow the rest of the instructions above.
> > > Same as above
>
> > > ~Brian
>
> > > On Jan 30, 4:55 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > I replace the Popen(command) with Popen(list_of_args) and this
> > > > (according to some) should fix the escaping problem. Needs testing.
>
> > > > Massimo
>
> > > > On Jan 30, 4:50 pm, Jonathan Lundell <jlund...@pobox.com> wrote:
>
> > > > > On Jan 30, 2010, at 1:40 PM, mdipierro wrote:
>
> > > > > > The problem is when paths contain spaces.
>
> > > > > > I thought even in windows in this case one should esacpe spaces with
> > > > > > '\ ' and use either \\ ('\\\\' in python) or / ('/') to separate
> > > > > > folders. For example:
>
> > > > > > 'C:/windows/Documents\ and\ Settings/'
>
> > > > > > or
>
> > > > > > 'C:\\windows\\Documents\ and\ Settings\\'
>
> > > > > > Am I wrong?
>
> > > > > I think so, but I'm no expert on the subject.
>
> > > > > Consider that if 'c:\\abc' makes Windows see 'c:\abc', then escaping 
> > > > > the space isn't going to have any effect.
>
> > > > > You can quote a command on the command line, so possibly something 
> > > > > like:
>
> > > > > '"C:\\windows\\Documents and Settings\\"'
>
> > > > > might work. Forward slashes are permitted in system calls, but IIRC 
> > > > > not on the command line, where (at least back in the DOS days) they 
> > > > > denoted command options (equivalent to - in Unix). I'd expect cron 
> > > > > entries to be more like command-line or batch-file content.
>
> > > > > But as I say, I'm no expert.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to