Cron w/ rails

I’m trying to setup a number of recurring processes and based on the
input of others have found my way to cron. I’ve made a number of
attempts to setup jobs to perform any number of task, always receiving
error messages. I’ve come across requests by others with the identical
problem, but I’ve yet to find one that has been responded to.

I’m running OS X 10.4 with all the latest Ruby/Rails installs.

If I execute the following line in a Terminal window I get the expected
result “Testing”
ruby /Users/stocad/rrprojects/testproject/script/runner -e development
“puts ‘Testing’”

I’ve put the following line into my crontab:
30 * * * * ruby /Users/stocad/rrprojects/testproject/script/runner -e
development “puts ‘Testing’”

After the perscribed time has arrived (30 after any hour) I check my
email (I put a .forward file in my home directory as one of the
tutorials I was following suggested). My email contains the following
message:

/Users/stocad/rrprojects/mycms/script/…/config/boot.rb:18:in
require': No such file to load -- rubygems (LoadError) from /Users/stocad/rrprojects/testproject/script/../config/boot.rb:18 from /Users/stocad/rrprojects/testproject/script/runner:2:inrequire’
from /Users/stocad/rrprojects/testproject/script/runner:2

There are a good number of resources out there telling me what to do if
I’m missing rubygems altogether, but rubygems seems to be working for
me in all cases except when I attempt to run a ruby script through
cron.

Any assistance would be greatly appreciated.

Aaron wrote:

I’ve put the following line into my crontab:
30 * * * * ruby /Users/stocad/rrprojects/testproject/script/runner -e
development “puts ‘Testing’”

It looks to me like you need to add a PATH line before the above – the
standard system path doesn’t include the path to your Ruby installation.
Just type

echo $PATH

in a term window, and copy what you get. Then add the line

PATH=

at the top of your crontab.

Hope this helps.

–Al Evans