James Britt wrote:
> Russell Fulton wrote:
>> Any idea where to look for the problem?
> What is the user that actually runs the job in cron?
> 
> Are you using absolute paths?
> 
> #!/usr/local/bin/ruby
> 
> not
> 
> #!/usr/bin/env ruby
> 
we are getting close here!  I've managed to reproduce the error on the 
cli by executing the file directly instead of running ruby <filename>

i.e
 selms.rb ... dies
whereas
ruby selms.rb ... works fine.

file starts with:

#! /usr/bin/ruby

[rful011@pateke selms]$ ls -l  /usr/bin/ruby
-rwxr-xr-x    1 root     root         3548 Oct  5  2005 /usr/bin/ruby

cron job looks like this:

40 * * * *              cd /home/rful011/selms; ruby ./selms.rb  -M -o 
selms -t periodic   log.patterns

note that the script is invoked via ruby in the cron job but gives the 
same symptoms as the file being executed directly.

Here is the output from the cron job:

SHELL=/bin/sh
MAILTO=irt / auckland.ac.nz
SHEll=/bin/sh
OLDPWD=/home/logowner
USER=logowner
PATH=/usr/bin:/bin
PWD=/home/rful011/selms
SHLVL=1
HOME=/home/logowner
LOGNAME=logowner
_=/usr/bin/env
./selms.rb:55: syntax error
when 'periodic' : Periodic.new( conf, $options[:syntax])
                 ^
./selms.rb:56: syntax error
when 'realtime' :
    ^

-- 
Posted via http://www.ruby-forum.com/.